Twitch IRC event message layout (sub example)

9:11 PM May 05 2020 code

Here is an example of the message string (with breakpoints to read it more easily) received from Twitch IRC chat when a user subscribes to a channel.

 @badge-info=subscriber/0
 badges=moderator/1,subscriber/0,premium/1
 color=#2226B2
 display-name=burago18
 emotes=
 flags=
 id=229ecd51-1ec2-4dda-ae43-6ac4058a25a3
 login=burago18
 mod=1
 msg-id=sub
 msg-param-cumulative-months=1
 msg-param-months=0
 msg-param-should-share-streak=0
 msg-param-sub-plan-name=Channel\sSubscription\s(yourchannel)
 msg-param-sub-plan=1000
 room-id=36476430
 subscriber=1
 system-msg=burago18\ssubscribed\sat\sTier\s1.
 tmi-sent-ts=1574904233310
 user-id=44812924
 user-type=mod :tmi.twitch.tv USERNOTICE #yourchannel

Useful information to parse from this are the msg-param-* parts, where you can get the subscription level selected, how many months, and other stuff that they use to display the event in the chat properly.

I'm using this to display notifications in a html5 canvas, which is rendered over the video stream in OBS, and also for a loyalty points system within a chatbot for that channel.

Similar to this layout, there's one for Twitch points, Twitch bits, raids, and other events with a custom style in the chat.

I’ll post that example in a future update. I also want to document how I solved many features requested for chatbots, loyalty systems, Discord integration, and more.