Overview
Events
- onAction
- onAnnouncement
- onAuthenticationFailure
- onAuthenticationSuccess
- onBan
- onBitsBadgeUpgrade
- onChatClear
- onCommunityPayForward
- onCommunitySub
- onConnect
- onDisconnect
- onEmoteOnlyToggle
- onFollowersOnlyToggle
- onGiftPaidUpgrade
- onJoin
- onJoinFailure
- onLeave
- onMessage
- onMessageFailed
- onMessageRemove
- onPrimePaidUpgrade
- onRaid
- onRaidCancel
- onResub
- onSlowModeToggle
- onStandardPayForward
- onSub
- onSubGift
- onSubsOnlyToggle
- onTimeout
- onTokenFetchFailure
- onUniqueChatToggle
- onWhisper
Methods
- actiona
- addVipa
- addVipByIdsa
- announcea
- announceByIda
- bana
- banByIdsa
- changeColora
- cleara
- clearByIda
- deleteMessagea
- deleteMessageByIda
- disableEmoteOnlya
- disableEmoteOnlyByIda
- disableFollowersOnlya
- disableFollowersOnlyByIda
- disableSlowModea
- disableSlowModeByIda
- disableSubsOnlya
- disableSubsOnlyByIda
- disableUniqueChata
- disableUniqueChatByIda
- enableEmoteOnlya
- enableEmoteOnlyByIda
- enableFollowersOnlya
- enableFollowersOnlyByIda
- enableSlowModea
- enableSlowModeByIda
- enableSubsOnlya
- enableSubsOnlyByIda
- enableUniqueChata
- enableUniqueChatByIda
- getModsa
- getModsByIda
- getVipsa
- getVipsByIda
- joina
- leave
- moda
- modByIdsa
- purgea
- purgeByIdsa
- removeVipa
- removeVipByIdsa
- replya
- runCommerciala
- runCommercialByIda
- saya
- timeouta
- timeoutByIdsa
- unbana
- unbanByIdsa
- unmoda
- unmodByIdsa
- whispera
- whisperByIda
Constructor
new Bot(config)
Creates a new bot.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
config | BotConfig | none | The configuration for the bot. |
Events
onAction((event) => { /* ... */ })
Fires when a user sends an action (/me) to a channel.
Parameter | Type | Description |
---|---|---|
event | MessageEvent | The event object. |
onAnnouncement((event) => { /* ... */ })
Fires when a user sends an announcement (/announce) to a channel.
Parameter | Type | Description |
---|---|---|
event | AnnouncementEvent | The event object. |
onAuthenticationFailure((text, retryCount) => { /* ... */ })
Fires when authentication fails.
Parameter | Type | Description |
---|---|---|
text | string | The message text. |
retryCount | number | The number of authentication attempts, including this one, that failed in the current attempt to connect. Resets when authentication succeeds. |
onBan((event) => { /* ... */ })
Fires when a user is permanently banned from a channel.
Parameter | Type | Description |
---|---|---|
event | BanEvent | The event object. |
onBitsBadgeUpgrade((event) => { /* ... */ })
Fires when a user upgrades their bits badge in a channel.
Parameter | Type | Description |
---|---|---|
event | BitsBadgeUpgradeEvent | The event object. |
onChatClear((event) => { /* ... */ })
Fires when the chat of a channel is cleared.
Parameter | Type | Description |
---|---|---|
event | ChatClearEvent | The event object. |
onCommunityPayForward((event) => { /* ... */ })
Fires when a user pays forward a subscription that was gifted to them to the community.
Parameter | Type | Description |
---|---|---|
event | CommunityPayForwardEvent | The event object. |
onCommunitySub((event) => { /* ... */ })
Fires when a user gifts random subscriptions to the community of a channel.
Community subs also fire multiple onSubGift
events.
To prevent alert spam, check the example on how to handle sub gift spam.
Parameter | Type | Description |
---|---|---|
event | CommunitySubEvent | The event object. |
onDisconnect((manually, reason) => { /* ... */ })
Fires when the client disconnects from the chat server.
Parameter | Type | Description |
---|---|---|
manually | boolean | Whether the disconnect was requested by the user. |
reason | Error | The error that caused the disconnect, or |
onEmoteOnlyToggle((event) => { /* ... */ })
Fires when emote-only mode is toggled in a channel.
Parameter | Type | Description |
---|---|---|
event | EmoteOnlyToggleEvent | The event object. |
onFollowersOnlyToggle((event) => { /* ... */ })
Fires when followers-only mode is toggled in a channel.
Parameter | Type | Description |
---|---|---|
event | FollowersOnlyToggleEvent | The event object. |
onGiftPaidUpgrade((event) => { /* ... */ })
Fires when a user upgrades their gift subscription to a paid subscription in a channel.
Parameter | Type | Description |
---|---|---|
event | GiftPaidUpgradeEvent | The event object. |
onJoin((event) => { /* ... */ })
Fires when a user joins a channel.
The join/leave events are cached by the Twitch chat server and will be batched and sent every 30-60 seconds.
Please note that if you have not enabled the requestMembershipEvents
option
or the channel has more than 1000 connected chatters, this will only react to your own joins.
Parameter | Type | Description |
---|---|---|
event | JoinEvent | The event object. |
onJoinFailure((event) => { /* ... */ })
Fires when you fail to join a channel.
Parameter | Type | Description |
---|---|---|
event | JoinFailureEvent | The event object. |
onLeave((event) => { /* ... */ })
Fires when a user leaves ("parts") a channel.
The join/leave events are cached by the Twitch chat server and will be batched and sent every 30-60 seconds.
Please note that if you have not enabled the requestMembershipEvents
option
or the channel has more than 1000 connected chatters, this will only react to your own leaves.
Parameter | Type | Description |
---|---|---|
event | LeaveEvent | The event object. |
onMessage((event) => { /* ... */ })
Fires when a user sends a message to a channel.
Parameter | Type | Description |
---|---|---|
event | MessageEvent | The event object. |
onMessageFailed((channel, reason) => { /* ... */ })
Fires when sending a message fails.
Parameter | Type | Description |
---|---|---|
channel | string | The channel that rejected the message. |
reason | string | The reason for the failure, e.g. you're banned (msg_banned) |
onMessageRemove((event) => { /* ... */ })
Fires when a single message is removed from a channel.
Parameter | Type | Description |
---|---|---|
event | MessageRemoveEvent | The event object. |
onPrimePaidUpgrade((event) => { /* ... */ })
Fires when a user upgrades their Prime subscription to a paid subscription in a channel.
Parameter | Type | Description |
---|---|---|
event | PrimePaidUpgradeEvent | The event object. |
onRaid((event) => { /* ... */ })
Fires when a user raids a channel.
Parameter | Type | Description |
---|---|---|
event | RaidEvent | The event object. |
onRaidCancel((event) => { /* ... */ })
Fires when a user cancels a raid.
Parameter | Type | Description |
---|---|---|
event | RaidCancelEvent | The event object. |
onResub((event) => { /* ... */ })
Fires when a user resubscribes to a channel.
Parameter | Type | Description |
---|---|---|
event | SubEvent | The event object. |
onSlowModeToggle((event) => { /* ... */ })
Fires when slow mode is toggled in a channel.
Parameter | Type | Description |
---|---|---|
event | SlowModeToggleEvent | The event object. |
onStandardPayForward((event) => { /* ... */ })
Fires when a user pays forward a subscription that was gifted to them to a specific user.
Parameter | Type | Description |
---|---|---|
event | StandardPayForwardEvent | The event object. |
onSub((event) => { /* ... */ })
Fires when a user subscribes to a channel.
Parameter | Type | Description |
---|---|---|
event | SubEvent | The event object. |
onSubGift((event) => { /* ... */ })
Fires when a user gifts a subscription to a channel to another user.
Community subs also fire multiple onSubGift
events.
To prevent alert spam, check the example on how to handle sub gift spam.
Parameter | Type | Description |
---|---|---|
event | SubGiftEvent | The event object. |
onSubsOnlyToggle((event) => { /* ... */ })
Fires when sub only mode is toggled in a channel.
Parameter | Type | Description |
---|---|---|
event | SubsOnlyToggleEvent | The event object. |
onTimeout((event) => { /* ... */ })
Fires when a user is timed out from a channel.
Parameter | Type | Description |
---|---|---|
event | BanEvent | The event object. |
onTokenFetchFailure((error) => { /* ... */ })
Fires when fetching a token fails.
Parameter | Type | Description |
---|---|---|
error | Error | The error that was thrown. |
onUniqueChatToggle((event) => { /* ... */ })
Fires when unique chat mode is toggled in a channel.
Parameter | Type | Description |
---|---|---|
event | UniqueChatToggleEvent | The event object. |
onWhisper((event) => { /* ... */ })
Fires when receiving a whisper from another user.
Parameter | Type | Description |
---|---|---|
event | WhisperEvent | The event object. |
Properties
Methods
action(channelName, text)
asyncSends an action (/me) to the given channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channelName | string | none | The name of the channel to send the action to. | |
text | string | none | The text to send. |
addVip(channelName, userName)
asyncGives a user VIP status in the given channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channelName | string | none | The name of the channel to give the user VIP status in. | |
userName | string | none | The name of the user to give VIP status. |
addVipByIds(channel, user)
asyncGives a user VIP status in the given channel using the channel and user IDs.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The channel to give the user VIP status in. | |
user | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The user to give VIP status. |
announce(channelName, text, color)
asyncSends an announcement to the given channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channelName | string | none | The name of the channel to send the announcement to. | |
text | string | none | The text to send. | |
color | ChatAnnouncementColor Aliased type: 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. |
announceById(channel, text, color)
asyncSends an announcement to the given channel using its ID.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The channel to send the announcement to. | |
text | string | none | The text to send. | |
color | ChatAnnouncementColor Aliased type: 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. |
ban(channelName, userName, reason)
asyncBans a user from the given channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channelName | string | none | The name of the channel to ban the user from. | |
userName | string | none | The name of the user to ban. | |
reason | string | none | The reason for the ban. |
banByIds(channel, user, reason)
asyncBans a user from the given channel using the channel and user IDs.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The channel to ban the user from. | |
user | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The user to ban. | |
reason | string | none | The reason for the ban. |
changeColor(color)
asyncChanges the bot's username color.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
color | ChatUserColor | none | The hexadecimal code (prefixed with #) or color name to use for your username. Please note that only Twitch Turbo or Prime users can use hexadecimal codes for arbitrary colors. If you have neither of those, you can only choose from the following color names: blue, blue_violet, cadet_blue, chocolate, coral, dodger_blue, firebrick, golden_rod, green, hot_pink, orange_red, red, sea_green, spring_green, yellow_green |
clear(channelName)
asyncRemoves all messages from the given channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channelName | string | none | The name of the channel to remove all messages from. |
clearById(channel)
asyncRemoves all messages from the given channel using its ID.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The channel to remove all messages from. |
deleteMessage(channelName, message)
asyncDeletes a message from the given channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channelName | string | none | The name of the channel to delete the message from. | |
message | string | ChatMessage | none | The message (as message ID or message object) to delete. |
deleteMessageById(channel, message)
asyncDeletes a message from the given channel using the channel ID.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The channel to delete the message from. | |
message | string | ChatMessage | none | The message (as message ID or message object) to delete. |
disableEmoteOnly(channelName)
asyncDisables emote-only mode in the given channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channelName | string | none | The name of the channel to disable emote-only mode in. |
disableEmoteOnlyById(channel)
asyncDisables emote-only mode in the given channel using its ID.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The channel to disable emote-only mode in. |
disableFollowersOnly(channelName)
asyncDisables followers-only mode in the given channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channelName | string | none | The name of the channel to disable followers-only mode in. |
disableFollowersOnlyById(channel)
asyncDisables followers-only mode in the given channel using its ID.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The channel to disable followers-only mode in. |
disableSlowMode(channelName)
asyncDisables slow mode in the given channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channelName | string | none | The name of the channel to disable slow mode in. |
disableSlowModeById(channel)
asyncDisables slow mode in the given channel using its ID.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The channel to disable slow mode in. |
disableSubsOnly(channelName)
asyncDisables subscribers-only mode in the given channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channelName | string | none | The name of the channel to disable subscribers-only mode in. |
disableSubsOnlyById(channel)
asyncDisables subscribers-only mode in the given channel using its ID.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The channel to disable subscribers-only mode in. |
disableUniqueChat(channelName)
asyncDisables unique chat mode in the given channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channelName | string | none | The name of the channel to disable unique chat mode in. |
disableUniqueChatById(channel)
asyncDisables unique chat mode in the given channel using its ID.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The channel to disable unique chat mode in. |
enableEmoteOnly(channelName)
asyncEnables emote-only mode in the given channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channelName | string | none | The name of the channel to enable emote-only mode in. |
enableEmoteOnlyById(channel)
asyncEnables emote-only mode in the given channel using its ID.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The channel to enable emote-only mode in. |
enableFollowersOnly(channelName, minFollowTime)
asyncEnables followers-only mode in the given channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channelName | string | none | The name of the channel to enable followers-only mode in. | |
minFollowTime | number | 0 | The time (in minutes) a user needs to be following before being able to send messages. |
enableFollowersOnlyById(channel, minFollowTime)
asyncEnables followers-only mode in the given channel using its ID.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The channel to enable followers-only mode in. | |
minFollowTime | number | 0 | The time (in minutes) a user needs to be following before being able to send messages. |
enableSlowMode(channelName, delayBetweenMessages)
asyncEnables slow mode in the given channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channelName | string | none | The name of the channel to enable slow mode in. | |
delayBetweenMessages | number | 30 | The time (in seconds) a user needs to wait between messages. |
enableSlowModeById(channel, delayBetweenMessages)
asyncEnables slow mode in the given channel using its ID.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The channel to enable slow mode in. | |
delayBetweenMessages | number | 30 | The time (in seconds) a user needs to wait between messages. |
enableSubsOnly(channelName)
asyncEnables subscribers-only mode in the given channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channelName | string | none | The name of the channel to enable subscribers-only mode in. |
enableSubsOnlyById(channel)
asyncEnables subscribers-only mode in the given channel using its ID.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The channel to enable subscribers-only mode in. |
enableUniqueChat(channelName)
asyncEnables unique chat mode in the given channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channelName | string | none | The name of the channel to enable unique chat mode in. |
enableUniqueChatById(channel)
asyncEnables unique chat mode in the given channel using its ID.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The channel to enable unique chat mode in. |
getMods(channelName)
asyncRetrieves a list of moderators in the given channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channelName | string | none | The name of the channel to retrieve the moderators of. |
getModsById(channel)
asyncRetrieves a list of moderators in the given channel using its ID.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The channel to retrieve the moderators of. |
getVips(channelName)
asyncRetrieves a list of VIPs in the given channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channelName | string | none | The name of the channel to retrieve the VIPs of. |
getVipsById(channel)
asyncRetrieves a list of VIPs in the given channel using its ID.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The channel to retrieve the VIPs of. |
join(channelName)
asyncJoins a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channelName | string | none | The name of the channel to join. |
leave(channelName)
Leaves a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channelName | string | none | The name of the channel to leave. |
mod(channelName, userName)
asyncGives a user moderator rights in the given channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channelName | string | none | The name of the channel to give the user moderator rights in. | |
userName | string | none | The name of the user to give moderator rights to. |
modByIds(channel, user)
asyncGives a user moderator rights in the given channel using the channel and user IDs.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The channel to give the user moderator rights in. | |
user | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The user to give moderator rights to. |
purge(channelName, userName, reason)
asyncRemoves all messages of a user from the given channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channelName | string | none | The name of the channel to purge the user's messages from. | |
userName | string | none | The name of the user to purge. | |
reason | string | '' | The reason for the purge. |
purgeByIds(channel, user, reason)
asyncRemoves all messages of a user from the given channel using the channel and user IDs.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The channel to purge the user's messages from. | |
user | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The user to purge. | |
reason | string | '' | The reason for the purge. |
removeVip(channelName, userName)
asyncTakes VIP status from a user in the given channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channelName | string | none | The name of the channel to take the user's VIP status in. | |
userName | string | none | The name of the user to take VIP status from. |
removeVipByIds(channel, user)
asyncTakes VIP status from a user in the given channel using the channel and user IDs.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The channel to take the user's VIP status in. | |
user | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The user to take VIP status from. |
reply(channel, text, replyToMessage)
asyncSends a reply to another chat message to the given channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | The channel to send the message to. | |
text | string | none | The text to send. | |
replyToMessage | string | ChatMessage | none | The message (or ID of the message) to reply to. |
runCommercial(channelName, length)
asyncRuns a commercial break on the given channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channelName | string | none | The name of the channel to run the commercial break on. | |
length | CommercialLength The possible lengths of a channel commercial. Aliased type: 30 | 60 | 90 | 120 | 150 | 180 | 30 | The duration of the commercial break. |
runCommercialById(channel, length)
asyncRuns a commercial break on the given channel using its ID.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The channel to run the commercial break on. | |
length | CommercialLength The possible lengths of a channel commercial. Aliased type: 30 | 60 | 90 | 120 | 150 | 180 | 30 | The duration of the commercial break. |
say(channel, text, attributes)
asyncSends a regular chat message to the given channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | The channel to send the message to. | |
text | string | none | The text to send. | |
attributes | ChatSayMessageAttributes | <complex> | The attributes to add to the message. |
timeout(channelName, userName, duration, reason)
asyncTimes out a user in the given channel and removes all their messages.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channelName | string | none | The name of the channel to time out the user in. | |
userName | string | none | The name of the user to time out. | |
duration | number | 60 | The time (in seconds) until the user can send messages again. Defaults to 1 minute. | |
reason | string | '' | The reason for the timeout. |
timeoutByIds(channel, user, duration, reason)
asyncTimes out a user in the given channel and removes all their messages using the channel and user IDs.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The channel to time out the user in. | |
user | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The user to time out. | |
duration | number | 60 | The time (in seconds) until the user can send messages again. Defaults to 1 minute. | |
reason | string | '' | The reason for the timeout. |
unban(channelName, userName)
asyncUnban a user from the given channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channelName | string | none | The name of the channel to unban the user from. | |
userName | string | none | The name of the user to unban. |
unbanByIds(channel, user)
asyncUnbans a user from the given channel using the channel and user IDs.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The channel to unban the user from. | |
user | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The user to unban. |
unmod(channelName, userName)
asyncTakes moderator rights from a user in the given channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channelName | string | none | The name of the channel to remove the user's moderator rights in. | |
userName | string | none | The name of the user to take moderator rights from. |
unmodByIds(channel, user)
asyncTakes moderator rights from a user in the given channel using the channel and user IDs.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The channel to remove the user's moderator rights in. | |
user | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The user to take moderator rights from. |
whisper(targetName, text)
asyncSends a whisper message to the given user.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
targetName | string | none | The name of the user to send the whisper message to. | |
text | string | none | The text to send. |
whisperById(target, text)
asyncSends a whisper message to the given user using their ID.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
target | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The user to send the whisper message to. | |
text | string | none | The text to send. |