Contents

Using Twitch Chat Commands

Your bot may send the following chat commands by using a PRIVMSG message. To use some of the commands, such as /ban and /emoteonly, your bot must have moderator privileges.

PRIVMSG #<channel> :/ban <user> <reason>

The following table lists the Twitch chat commands your bot can send and the required scopes. If the command isn’t listed here, it’s not supported. For more information about these commands, see Chat Commands.

Chat command Required scope Usage
/ban, /unban channel:moderate Bans a user from the channel. Use /unban to remove the ban.

/ban <user> [<reason>]
/unban <user>
/clear channel:moderate Clears all messages from the chat room

/clear
/color chat:edit Changes the color used for the bot’s username.

/color [<color string like red> | <hex color code like #0D4200>]
/commercial channel_commercial Runs a commercial.

/commercial [30 | 60 | 90 | 120 | 150 | 180]

The default is 30 seconds.
/delete channel:moderate Deletes the specified message from the chat room. To get the ID, specify the tags capability. The PRIVMSG message’s id tag contains the ID.

A bot may not delete the broadcaster’s messages.

/delete <message ID>
/disconnect chat:edit Disconnects the bot from the IRC server. This is the same as sending a PART message.

/disconnect
/emoteonly, /emoteonlyoff channel:moderate Restricts users to posting chat messages that contain only emoticons. Use /emoteonlyoff to remove the restriction.

/emoteonly
/emoteonlyoff
/followers, /followersoff channel:moderate Restricts who can post chat messages to followers only. Use /followersoff to remove the restriction.

/followers <minimum length of time following channel>
/followersoff
/help chat:edit Returns a usage statement for the specified command. If you don’t specify a command, it returns all commands that the user can use.

/help [<command>]
/host, /unhost channel_editor Hosts another channel in this channel. To stop hosting the other channel, use /unhost.

/host <channel>
/unhost
/marker channel_editor Marks a section of the broadcast to highlight later.

/marker [<description>]
/me chat:edit Removes the colon that typically appears after your chat name and italicizes the chat message’s text.

/me <message>
/mod, /unmod channel:moderate Gives a user moderator privileges. To revoke the privilege, use /unmod.

/mod <user>
/unmod
/mods chat:edit Lists the users that are moderators on the channel.

/mods
/raid, /unraid channel_editor Starts/stops a raid. A raid sends your viewers to the specified channel.

/raid <channel>
/unraid
/slow, /slowoff channel:moderate Restricts how often users can post messages. This sets the minimum time, in seconds, that a user must wait before being allowed to post another message. Use /slowoff to remove the restriction.

/slow [minimum wait time in seconds]
slowoff
/subscribers, /subscribersoff channel:moderate Restricts who can post chat messages to subscribers only. Use /subscribersoff to remove the restriction.

/subscribers
/subscribersoff
/timeout, /untimeout channel:moderate Places the user in a timeout; the user cannot chat until the timeout expires or someone removes it using /untimeout.

/timeout <user> [<length>]
/untimeout <user>
/uniquechat, /uniquechatoff channel:moderate Restricts a user’s chat messages to unique messages only; a user cannot send duplicate chat messages until someone removes the restriction using /uniquechatoff.

/uniquechat
/uniquechatoff
/vip, /unvip channel:moderate Grants/revokes VIP status to a user.

/vip <user>
unvip
/vips chat:edit Lists the users with VIP status in the channel.

/vips
/w whispers:edit Sends a private message to another user on Twitch. NOTE The whisper chat command is available to legacy chatbots only.

/w <user> <message>

The Twitch IRC server replies with a NOTICE message indicating whether the command succeeded or failed.

The following example shows the NOTICE command that the server replies with when the bot sends the /uniquechat chat command and the command succeeded.

@msg-id=r9k_on :tmi.twitch.tv NOTICE #<channel> :This room is now in unique-chat mode.

If the chat command fails, the server might send a reply like:

@msg-id=already_r9k_on :tmi.twitch.tv NOTICE #barbar :This room is already in unique-chat mode.

For messages such as /uniquechat that change a chat room setting, the server also replies with a ROOMSTATE message.

@r9k=1;room-id=713936733 :tmi.twitch.tv ROOMSTATE #<channel>

NOTE Although you can use these commands to perform moderation and other actions in chat, you’re encouraged to use the Twitch APIs instead. The following list maps the chat commands to their API equivalence.

Chat command API
/ban, /timeout Ban User
/commercial Start Commercial
/emoteonly, /emoteonlyoff Update Chat Settings
/followers, /followersoff Update Chat Settings
/marker Get Stream Marker
/mods Get Moderators
/slow, /slowoff Update Chat Settings
/subscribers, /subscribersoff Update Chat Settings
/unban, /untimeout Unban User
/uniquechat, /uniquechatoff Update Chat Settings