11 releases

0.1.3 Mar 16, 2024
0.1.2 Mar 12, 2024
0.0.8 Mar 2, 2024
0.0.4 Feb 29, 2024

#2 in #irc-v3

Download history 528/week @ 2024-02-29 388/week @ 2024-03-07 242/week @ 2024-03-14 12/week @ 2024-03-21 50/week @ 2024-03-28 23/week @ 2024-04-04

90 downloads per month
Used in twitch_ircv3_parse

MIT/Apache

9KB
134 lines

IRCv3 parse


lib.rs:

IRCv3 parse

Example

use std::collections::HashMap;
use ircv3_parse::ircv3_parse;
let msg = "@badge-info=;badges=broadcaster/1;client-nonce=997dcf443c31e258c1d32a8da47b6936;color=#0000FF;display-name=abc;emotes=;first-msg=0;flags=0-6:S.7;id=eb24e920-8065-492a-8aea-266a00fc5126;mod=0;room-id=713936733;subscriber=0;tmi-sent-ts=1642786203573;turbo=0;user-id=713936733;user-type= :abc!abc@abc.tmi.twitch.tv PRIVMSG #xyz :HeyGuys\r\n";
let (tags, prefix, command, params) = ircv3_parse(msg);
let expeced_tags= HashMap::from([
    ("badge-info", ""),
    ("subscriber", "0"),
    ("id", "eb24e920-8065-492a-8aea-266a00fc5126"),
    ("user-id", "713936733"),
    ("emotes", ""),
    ("tmi-sent-ts", "1642786203573"),
    ("client-nonce", "997dcf443c31e258c1d32a8da47b6936"),
    ("mod", "0"),
    ("badges", "broadcaster/1"),
    ("room-id", "713936733"),
    ("flags", "0-6:S.7"),
    ("color", "#0000FF"),
    ("turbo", "0"),
    ("display-name", "abc"),
    ("first-msg", "0"),
    ("user-type", "")]);



assert_eq!(prefix.as_ref(), &Some(("abc", Some("abc@abc.tmi.twitch.tv"))));
assert_eq!(command, "PRIVMSG");
assert_eq!(params.channel(), Some("#xyz"));
assert_eq!(params.message(), Some("HeyGuys"));

Dependencies

~1MB
~17K SLoC