Chatbots & IRC:
Twitch IRC Capability:
A channel can have multiple chat rooms. They can be previewed differently and have different join permissions; e.g., general, moderators-only, or subscribers-only.
To distinguish among the chat rooms in a given channel, the commands in the following table use a UUID for each room. The UUID is unique across all of Twitch. To get a chat room’s UUID, use the Get Chat Rooms by Channel endpoint.
|JOIN||Join a specified chat room in a channel.|
|NOTICE||Receive a general notice from the server.|
|PRIVMSG||Send a message to a chat room.|
|ROOMSTATE||Changes a room’s state.|
|USERSTATE||Changes a user’s state.|
JOIN (Twitch Chat Rooms)
Join a specified chat room in a channel.
> :<user>!<user>@<user>.tmi.twitch.tv JOIN #chatrooms:<channel ID>:<room UUID>
Example: ronni joined chat room 04e762ec-ce8f-4cbc-b6a3-ffc871ab53da in channel 44322889.
> :email@example.com JOIN #chatrooms:44322889:04e762ec-ce8f-4cbc-b6a3-ffc871ab53da
NOTICE (Twitch Chat Rooms)
Receive a general notice from the server.
> @msg-id=<msg id>:tmi.twitch.tv NOTICE #chatrooms:<channel ID>:<room UUID> :<message>
||A message ID string. Valid values: see Twitch IRC: msg-id Tags.|
> @msg-id=slow_off :tmi.twitch.tv NOTICE #chatrooms:44322889:04e762ec-ce8f-4cbc-b6a3-ffc871ab53da :This room is no longer in slow mode.
PRIVMSG (Twitch Chat Rooms)
Send a message to a chat room. Only some Twitch Chat slash commands (/) are supported.
> :<user>!<user>@<user>.tmi.twitch.tv PRIVMSG #chatrooms:<channel ID>:<room UUID> :This is a sample message
PRIVMSG: Supported Twitch Chat Slash Commands
For the following commands, there is no change in behavior.
|General Commands||User Moderation Commands||Room Moderation Commands|
PRIVMSG: Unsupported Twitch Chat Slash Commands
If you try to use any of the following commands in the context of a chat room, a NOTICE is returned, with:
message: “The command <command> cannot be used in a chatroom”
|General Commands||Room Moderation Commands|
ROOMSTATE (Twitch Chat Rooms)
Changes a room’s state. When a user joins a channel or a room, the room’s state is changed. For a join, the message contains all chat-room settings. For changes, only the relevant tag is sent.
> @emote-only=<emote only>;room-id=<channel ID>;r9k=<r9k>;slow=<slow>;:tmi.twitch.tv ROOMSTATE #chatrooms:<channel ID>:<room UUID>:<message>
||Emote only mode. If enabled, only messages with emotes are allowed. Valid values:
||The channel ID for the channel owner (i.e., the broadcaster). Note that this value is specified twice in the command.|
||R9K mode. If enabled, messages with more than 9 characters must be unique. Valid values:
||The number of seconds chatters without moderator privileges must wait between sending messages.|
Example: This is for a join in chat room 04e762ec-ce8f-4cbc-b6a3-ffc871ab53da in channel 44322889.
> @emote-only=0;room-id=44322889;r9k=0;slow=0 :tmi.twitch.tv ROOMSTATE #chatrooms:44322889:04e762ec-ce8f-4cbc-b6a3-ffc871ab53da
Example: In chat room 04e762ec-ce8f-4cbc-b6a3-ffc871ab53da in channel 44322889, slow mode is set to 10 seconds.
> @room-id=44322889;slow=10 :tmi.twitch.tv ROOMSTATE #chatrooms:44322889:04e762ec-ce8f-4cbc-b6a3-ffc871ab53da
USERSTATE (Twitch Chat Rooms)
Changes a user’s state. Use when a user joins a chat room or sends a PRIVMSG to a chat room. Use with the tags capability; see USERSTATE(Twitch Tags), which has additional parameters.
> :tmi.twitch.tv USERSTATE #chatrooms:<channel ID>:<room UUID>