Message tags, parse emotes

I previously used the TWITCHCLIENT 3 jtv messages to identify emotes in chat by only matching towards the sets previously stated.

:jtv!jtv@jtv.tmi.twitch.tv PRIVMSG #monstercat :EMOTESET nightbot [27,42,50,74,75,76,105,189,516,538,554,646,748,793,886,1031,1570,1693,1838,1925,2072,2156,2212,2406,2456,2462,3347,3606,3865,4589,4692,5395,5449,5478,5504,5581,6118,6476,6495,6535,7055,7390,7747,7921,8599,9203,9750,10212,10449]

These sets correlate to the sets in http://twitchemotes.com/api_cache/v2/subscriber.json which I saved locally instead of calling Twitch API. The below command seems a lot easier to handle though.

CAP REQ :twitch.tv/tags

But firstly, I don’t see any documentation on how to parse “emotes=” though:

@color=#8A2BE2;emotes=34:9-17,28-36,47-55/22639:0-7,19-26,38-45;subscriber=0;turbo=0;user_type= :alkeos_!alkeos_@alkeos_.tmi.twitch.tv PRIVMSG #monstercat :BabyRage SwiftRage BabyRage SwiftRage BabyRage SwiftRage

34: and 22639: seems to be the image_id(?), and the following numbers seperated by ‘-’ seems to be start and end index (inclusive) of such an emote. Each emote found is seperated by ‘/’. Correct?

Where can I grab a json that maps numbers like 34 and 22639 to “SwiftRage” and “BabyRage”? Also, can I assume that the emotes in “emotes=” are only ones the user have the subscription to show?

Secondly, what is “user_type=”? I haven’t seen it have any value yet, but my guess it could say “staff” or “admin”?

Relevant Link. For emotes it is emote id, followed by its location in the string. You can use this link to get the code from the id, or http://static-cdn.jtvnw.net/emoticons/v1/(emote id)/1.0 to get the image directly. The 1.0 can be 1.0, 2.0, or 3.0 depending on what size you want to serve. And the emote tag will only tell you emotes that that user is allowed to use, and should be replaced with the image.

2 Likes

Thank you, that was everything I needed! :smiley:

staff, admin, global_mod or mod. For the broadcaster it is either blank or mod (if they modded themselves in their own channel).

1 Like

If you just need the text version of the emote and don’t care about emoticon_set, you can avoid hitting emoticon_images entirely by assuming the text contained by the two indices TMI provides you is the text version of the emote.

e.g. if you get @emotes=25:3-8 :fugi!fugi@fugi.tmi.twitch.tv PRIVMSG #twitch :Hi Kappa, you know that message[3:8] contains the text version of emote 25, Kappa.

3 Likes

Wow @Fugiman, of course its that simple… :expressionless:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.