Skip to main content

Chat 101

The most used type of interaction your game will have with users will probably be using the Channel Chat. In order to use this, we have created a whole suite of nodes allowing you to do anything from receiving chat messages, to moderating the chat. Let's go over a few important ones.

The node that will most likely be using the most is the OnTwitchMessage node. This event node needs to be passed in when connecting to Twitch, and will be called every time a user posts a message on the channel you're "listening" to. When this node gets called, it will give you a TwitchMessage struct, which contains a Message Author (struct), Message Body (String), and a Room ID (will be omitted for now). The Message Author contains information such as the user's role, color, (display) name and more. Use the break node, or refer to later sections to find out more about this.

Next, are the moderation nodes. These are Clear Twitch Chat (will remove all the messages in the twitch chat you're connected to), Enable/Disable Twitch [Slow, R9K, Follows Only, and Emote Only] Chat, enabling or disabling Slow Chat (users can only send a message each Seconds interval), an anti-spam measure, a mode that only allows your followers to talk, and a chat that only allows viewers to chat using Emotes respectively. There are also nodes for Temporarily and Permanently banning twitch user, Temp Ban Twitch User, and Permanently Ban Twitch User respectively.

Once a user has types a message, or you have used a chat moderation node, you way want to inform users about this. To do this, you can send a message back to the Twitch Chat using the "Send Twitch Message" node, passing in your Twitch Chat and a string containing the Message you want to respond with.

When designing your interactive games, please take note of the fact that Twitch has a 10 (fast streaming) or (roughly) 30 second delay time when streaming. This means that a user won't see their chat messages/commands in-game till the delay has passed, and the player may have to wait for viewer responses to come in. This shouldn't be a hugely limiting factor, but should be kept in mind when designing games.