public Chatter(IRCPrivmsg Privmsg, IRCTags Tags) { login = Privmsg.login; channel = Privmsg.channel; message = Privmsg.message; tags = Tags; }
private void HandleUSERSTATE(string ircString, string tagString) { // Parse USERSTATE IRCUserstate userstate = new IRCUserstate(ParseHelper.ParseChannel(ircString)); // Parse Tags IRCTags tags = ParseHelper.ParseTags(tagString, settings.parseBadges, settings.parseTwitchEmotes); clientChatter = new Chatter(userstate, tags); }
public static IRCTags ParseTags(string tagString, bool parseBadges, bool parseTwitchEmotes) { IRCTags tags = new IRCTags(); string[] split = tagString.Split(';'); //Loop through tags for (int i = 0; i < split.Length; ++i) { string value = split[i].Substring(split[i].IndexOf('=') + 1); if (value.Length <= 0) //Ignore empty tags { continue; } //Find the tags needed switch (split[i].Substring(0, split[i].IndexOf('='))) { case "badges": if (parseBadges) { tags.badges = ParseBadges(value.Split(',')); } continue; case "color": tags.colorHex = value; continue; case "display-name": tags.displayName = value; continue; case "emotes": if (parseTwitchEmotes) { tags.emotes.AddRange(ParseTwitchEmotes(value.Split('/'))); } continue; case "room-id": // room-id = channelId tags.channelId = value; continue; case "user-id": tags.userId = value; continue; } } return(tags); }
private IRCTags SetTags(Dictionary <string, string> tags) { if (tags == null || tags.Count == 0) { return(null); } var mTags = new IRCTags(); foreach (var pair in tags) { var ircKey = new IRCTagKey(); ircKey.Name = pair.Key; mTags.Values[ircKey] = pair.Value; } return(mTags); }
private void HandlePRIVMSG(string ircString, string tagString) { // Parse PRIVMSG IRCPrivmsg privmsg = new IRCPrivmsg( ParseHelper.ParseLoginName(ircString), ParseHelper.ParseChannel(ircString), ParseHelper.ParseMessage(ircString) ); // Parse Tags IRCTags tags = ParseHelper.ParseTags(tagString, settings.parseBadges, settings.parseTwitchEmotes); // Sort emotes to match emote order with the chat message (compares emote indexes) if (tags.emotes.Count > 0) { tags.emotes.Sort((a, b) => 1 * a.indexes[0].startIndex.CompareTo(b.indexes[0].startIndex)); } // Send chatter object to listeners // Invoke in main thread MainThread.Instance.Enqueue(() => newChatMessageEvent.Invoke(new Chatter(privmsg, tags))); }
public Chatter(IRCUserstate Userstate, IRCTags Tags) { channel = Userstate.channel; tags = Tags; }