Using Twitch Chat Commands
Chat commands through IRC have been deprecated and will no longer function on or about February 18, 2023. See the forum announcement for more details and discussion. Refer to the migration guide section below for equivalent Twitch API endpoints.
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>]
|/clear||channel:moderate||Clears all messages from the chat room
|/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
A bot may not delete the broadcaster’s messages.
/delete <message ID>
|/disconnect||chat:edit||Closes the session that the command was received from.
|/emoteonly, /emoteonlyoff||channel:moderate||Restricts users to posting chat messages that contain only emoticons. Use /emoteonlyoff to remove the restriction.
|/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>
|/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.
|/host, /unhost||channel_editor||Hosts another channel in this channel. To stop hosting the other channel, use /unhost.
|/marker||channel_editor||Marks a section of the broadcast to highlight later.
|/me||chat:edit||Removes the colon that typically appears after your chat name and italicizes the chat message’s text.
|/mod, /unmod||channel:moderate||Gives a user moderator privileges. To revoke the privilege, use /unmod.
|/mods||chat:edit||Lists the users that are moderators on the channel.
|/raid, /unraid||channel_editor||Starts/stops a raid. A raid sends your viewers to the specified channel.
|/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]
|/subscribers, /subscribersoff||channel:moderate||Restricts who can post chat messages to subscribers only. Use /subscribersoff to remove the restriction.
|/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>]
|/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.
|/vip, /unvip||channel:moderate||Grants/revokes VIP status to a user.
|/vips||chat:edit||Lists the users with VIP status in the channel.
|/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>
As announced on September 7, 2022, Twitch chat commands will no longer be supported via IRC starting on or about February 18, 2023. Although you can use the commands above to perform moderation and other actions in chat until that time, you’re encouraged to migrate to their Twitch API equivalents at your convenience. The following list maps each chat command to its API equivalent and provides any further context for updating applications.
|Chat command||API endpoint||Notes|
|/announce||Send Chat Announcement|
|/clear||Delete Chat Messages|
|/color||Update User Chat Color
Get User Chat Color
|/commercial||Start Commercial||This API endpoint requires a broadcaster’s access token, i.e., a broadcaster should follow the authorization flow for your application and the resulting user token is used for the API request. In order for a user with the Editor role to start a commercial, they will need to use the command directly in a Twitch-owned chat interface or applications should be updated to use the broadcaster’s token.|
|/delete||Delete Chat Messages|
|/disconnect||N/A||Will continue to function as expected via IRC.|
|/emoteonly, /emoteonlyoff||Update Chat Settings|
|/followers, /followersoff||Update Chat Settings|
|/help||N/A||To be removed, not necessary with the removal of chat commands.|
|/host||N/A||Following the broader update that Host Mode will be removed in October 2022 (see the host mode help article FAQ), the “/host” chat command will not have a migration path to the Twitch API.|
|/marker||Get Stream Marker|
|/me||N/A||Will continue to function as expected via IRC.|
|/mod||Add Channel Moderator|
|/mods||Get Moderators||This API endpoint requires a broadcaster’s access token, i.e., a broadcaster should follow the authorization flow for your application and the resulting user token is used for the API request. While this is a requirement to retrieve a list of moderators programmatically, viewers can still use the /mods command in a Twitch-owned chat interface manually.|
|/unmod||Remove Channel Moderator|
|/raid||Start a Raid|
|/unraid||Cancel a Raid|
|/slow, /slowoff||Update Chat Settings|
|/subscribers, /subscribersoff||Update Chat Settings|
|/uniquechat, /uniquechatoff||Update Chat Settings|
|/user||N/A||To be removed.|
|/vip||Add Channel VIP|
|/vips||Get VIPs||This API endpoint requires a broadcaster’s access token, i.e., a broadcaster should follow the authorization flow for your application and the resulting user token is used for the API request. While this is a requirement to retrieve a list of VIPs programmatically, viewers can still use the /vips command in a Twitch-owned chat interface manually.|
|/unvip||Remove Channel VIP|