TwurpleAuthenticationGetting dataExamplesFAQMigration

BotCommandContext

The message context of a bot command execution handler.

Overview

Properties

broadcasterId

Type: string

The ID of the broadcaster.

broadcasterName

Type: string

The name of the broadcaster.

msg

Type: ChatMessage

userDisplayName

Type: string

The display name of the user who sent the message.

userId

Type: string

The ID of the user who sent the message.

userName

Type: string

The name of the user who sent the message.

Methods

action(text)

async

Sends an action (/me) to the channel.

ParameterTypeRequiredDefaultDescription
textstringnone

The text to send.

Return type: void

addVip()

async

Gives the user VIP status in the channel.

Return type: void

announce(text, color)

async

Sends an announcement to the channel.

ParameterTypeRequiredDefaultDescription
textstringnone

The text to send.

color
ChatAnnouncementColor

Aliased type:

HelixChatAnnouncementColor

The color used to highlight an announcement.

Aliased type: "blue" | "green" | "orange" | "purple" | "primary"

none

The color to send the announcement in. If not passed, uses the default channel color.

Return type: void

ban(reason)

async

Bans the user who sent the message from the channel.

ParameterTypeRequiredDefaultDescription
reasonstringnone

The reason for the ban.

Return type: void

clear()

async

Removes all messages from the channel.

Return type: void

delete()

async

Deletes the message from the channel.

Return type: void

disableEmoteOnly()

async

Disables emote-only mode in the channel.

Return type: void

disableFollowersOnly()

async

Disables followers-only mode in the channel.

Return type: void

disableSlow()

async

Disables slow mode in the channel.

Return type: void

disableSubsOnly()

async

Disables subscribers-only mode in the channel.

Return type: void

disableUniqueChat()

async

Disables unique chat mode in the channel.

Return type: void

enableEmoteOnly()

async

Enables emote-only mode in the channel.

Return type: void

enableFollowersOnly(minFollowTime)

async

Enables followers-only mode in the channel.

ParameterTypeRequiredDefaultDescription
minFollowTimenumber0

The time (in minutes) a user needs to be following before being able to send messages.

Return type: void

enableSlow(delayBetweenMessages)

async

Enables slow mode in the channel.

ParameterTypeRequiredDefaultDescription
delayBetweenMessagesnumber30

The time (in seconds) a user needs to wait between messages.

Return type: void

enableSubsOnly()

async

Enables subscribers-only mode in the channel.

Return type: void

enableUniqueChat()

async

Enables unique chat mode in the channel.

Return type: void

purge(reason)

async

Removes all messages of the user from the channel.

ParameterTypeRequiredDefaultDescription
reasonstring''

The reason for the purge.

Return type: void

removeVip()

async

Takes VIP status from the user in the channel.

Return type: void

reply(text)

async

Sends a reply to the chat message to the channel.

ParameterTypeRequiredDefaultDescription
textstringnone

The text to send.

Return type: void

runCommercial(length)

async

Runs a commercial break on the channel.

ParameterTypeRequiredDefaultDescription
length
CommercialLength

The possible lengths of a channel commercial.

Aliased type: 30 | 60 | 90 | 120 | 150 | 180

30

The duration of the commercial break.

Return type: void

say(text)

async

Sends a regular chat message to the channel.

ParameterTypeRequiredDefaultDescription
textstringnone

The text to send.

Return type: void

timeout(duration, reason)

async

Times out then user in the channel and removes all their messages.

ParameterTypeRequiredDefaultDescription
durationnumber30

The time (in seconds) until the user can send messages again. Defaults to 1 minute.

reasonstring''

The reason for the timeout.

Return type: void