8 releases

0.1.2 Mar 16, 2024
0.1.1 Mar 12, 2024
0.0.6 Mar 2, 2024
0.0.4 Feb 29, 2024

#1718 in Web programming

Download history 392/week @ 2024-02-25 65/week @ 2024-03-03 406/week @ 2024-03-10 110/week @ 2024-03-17 1/week @ 2024-03-24 53/week @ 2024-03-31

575 downloads per month
Used in 2 crates (via ircv3_parse)

MIT/Apache

8KB

IRCv3 message

only tags parse


lib.rs:

only parse IRCv3 tags part

Examples

use ircv3_tags::IRCv3Tags;
use std::collections::HashMap;

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";
let (remain, tags) = IRCv3Tags::parse(msg).unwrap();
let expected_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!(remain, ":abc!abc@abc.tmi.twitch.tv PRIVMSG #xyz :HeyGuys");
assert_eq!(tags.as_ref(), &Some(expected_tags));

let tmi_sent_ts = tags.get("tmi-sent-ts");
assert_eq!(tmi_sent_ts, Some("1642786203573"));

let notif = tags.get("not-if");
assert_eq!(notif, None);

Dependencies

~1MB
~17K SLoC