Overview
Events
- onAction
- onAuthenticationFailure
- onBan
- onBitsBadgeUpgrade
- onChatClear
- onCommunityPayForward
- onCommunitySub
- onEmoteOnly
- onFollowersOnly
- onGiftPaidUpgrade
- onHost
- onHosted
- onHostsRemaining
- onJoin
- onMessage
- onMessageFailed
- onMessageRatelimit
- onMessageRemove
- onNoPermission
- onPart
- onPrimeCommunityGift
- onPrimePaidUpgrade
- onPrivmsgd
- onR9k
- onRaid
- onRaidCancel
- onResub
- onRewardGift
- onRitual
- onSlow
- onStandardPayForward
- onSub
- onSubExtend
- onSubGift
- onSubsOnly
- onTimeout
- onUnhost
- onWhisper
Properties
Methods
- anonymouss
- forTwitchClientds
- actiona
- addCapability
- addListener
- addVipa
- addVIPda
- bana
- changeColora
- cleara
- connecta
- createMessage
- deleteMessagea
- disableEmoteOnlya
- disableFollowersOnlya
- disableR9ka
- disableSlowa
- disableSubsOnlya
- enableEmoteOnlya
- enableFollowersOnlya
- enableR9ka
- enableSlowa
- enableSubsOnlya
- getCommandClass
- getModsa
- getVipsa
- getVIPsda
- hosta
- joina
- knowsCommand
- moda
- on
- onNamedMessage
- onTypedMessage
- part
- pingCheck
- purgea
- quita
- raida
- receiveLine
- reconnecta
- registerCapabilitya
- registerEvent
- registerMessageType
- removeListener
- removeMessageListener
- removeVipa
- removeVIPda
- runCommerciala
- saya
- send
- sendCtcp
- sendMessage
- sendMessageAndCaptureReplya
- sendRaw
- timeouta
- unhosta
- unhostOutsidea
- unmoda
- unraida
- waitForRegistrationda
- whispera
Constructor
new ChatClient(authProvider, options)
Creates a new Twitch chat client.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
authProvider | ?AuthProvider | none | The AuthProvider instance to use for authentication. | |
options | ChatClientOptions Aliased type: WebSocketChatClientOptions | TcpChatClientOptions | {} |
Events
onAction((channel, user, message, msg) => { /* ... */ })
Fires when a user sends an action (/me) to a channel.
Parameter | Type | Description |
---|---|---|
channel | string | The channel the action was sent to. |
user | string | The user that send the action. |
message | string | The action text. |
msg | TwitchPrivateMessage | The full message object containing all message and user information. |
onAuthenticationFailure((message) => { /* ... */ })
Fires when authentication fails.
Parameter | Type | Description |
---|---|---|
message | string | The message text. |
onBan((channel, user) => { /* ... */ })
Fires when a user is permanently banned from a channel.
Parameter | Type | Description |
---|---|---|
channel | string | The channel the user is banned from. |
user | string | The banned user. |
onBitsBadgeUpgrade((channel, user, upgradeInfo, msg) => { /* ... */ })
Fires when a user upgrades their bits badge in a channel.
Parameter | Type | Description |
---|---|---|
channel | string | The channel where the bits badge was upgraded. |
user | string | The user that has upgraded their bits badge. |
upgradeInfo | ChatBitsBadgeUpgradeInfo | none |
msg | UserNotice | The full message object containing all message and user information. |
onChatClear((channel) => { /* ... */ })
Fires when the chat of a channel is cleared.
Parameter | Type | Description |
---|---|---|
channel | string | The channel whose chat is cleared. |
onCommunityPayForward((channel, user, forwardInfo, msg) => { /* ... */ })
Fires when a user pays forward a subscription that was gifted to them to the community.
Parameter | Type | Description |
---|---|---|
channel | string | The channel where the gift was forwarded. |
user | string | The user that forwarded the gift. |
forwardInfo | ChatCommunityPayForwardInfo | Additional information about the gift. |
msg | UserNotice | The full message object containing all message and user information. |
onCommunitySub((channel, user, subInfo, msg) => { /* ... */ })
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 Sub gift spam.
Parameter | Type | Description |
---|---|---|
channel | string | The channel that was subscribed to. |
user | string | The gifting user. |
subInfo | ChatCommunitySubInfo | Additional information about the community subscription. |
msg | UserNotice | The full message object containing all message and user information. |
onEmoteOnly((channel, enabled) => { /* ... */ })
Fires when emote-only mode is toggled in a channel.
Parameter | Type | Description |
---|---|---|
channel | string | The channel where emote-only mode is being toggled. |
enabled | boolean | Whether emote-only mode is being enabled. If false, it's being disabled. |
onFollowersOnly((channel, enabled, delay) => { /* ... */ })
Fires when followers-only mode is toggled in a channel.
Parameter | Type | Description |
---|---|---|
channel | string | The channel where followers-only mode is being toggled. |
enabled | boolean | Whether followers-only mode is being enabled. If false, it's being disabled. |
delay | number | The time (in minutes) a user needs to follow the channel to be able to talk. Only available when |
onGiftPaidUpgrade((channel, user, subInfo, msg) => { /* ... */ })
Fires when a user upgrades their gift subscription to a paid subscription in a channel.
Parameter | Type | Description |
---|---|---|
channel | string | The channel where the subscription was upgraded. |
user | string | The user that upgraded their subscription. |
subInfo | ChatSubGiftUpgradeInfo | Additional information about the subscription upgrade. |
msg | UserNotice | The full message object containing all message and user information. |
onHost((channel, target, viewers) => { /* ... */ })
Fires when a channel hosts another channel.
Parameter | Type | Description |
---|---|---|
channel | string | The hosting channel. |
target | string | The channel that is being hosted. |
viewers | number | The number of viewers in the hosting channel. If you're not logged in as the owner of the channel, this is undefined. |
onHosted((channel, byChannel, auto, viewers) => { /* ... */ })
Fires when a channel you're logged in as its owner is being hosted by another channel.
Parameter | Type | Description |
---|---|---|
channel | string | The channel that is being hosted. |
byChannel | string | The hosting channel. |
auto | boolean | Whether the host was triggered automatically (by Twitch's auto-host functionality). |
viewers | number | The number of viewers in the hosting channel. |
onHostsRemaining((channel, numberOfHosts) => { /* ... */ })
Fires when Twitch tells you the number of hosts you have remaining in the next half hour for the channel for which you're logged in as owner after hosting a channel.
Parameter | Type | Description |
---|---|---|
channel | string | The hosting channel. |
numberOfHosts | number | The number of hosts remaining in the next half hour. |
onJoin((channel, user) => { /* ... */ })
Fires when a user joins a channel.
The join/part events are cached by the Twitch chat server and will be batched and sent every 30-60 seconds.
Please note that unless you enabled the requestMembershipEvents
option, this will only react to your own joins.
Parameter | Type | Description |
---|---|---|
channel | string | The channel that is being joined. |
user | string | The user that joined. |
onMessage((channel, user, message, msg) => { /* ... */ })
Fires when a user sends a message to a channel.
Parameter | Type | Description |
---|---|---|
channel | string | The channel the message was sent to. |
user | string | The user that send the message. |
message | string | The message text. |
msg | TwitchPrivateMessage | The full message object containing all message and user information. |
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) |
onMessageRatelimit((channel, message) => { /* ... */ })
Fires when a message you tried to send gets rejected by the ratelimiter.
Parameter | Type | Description |
---|---|---|
channel | string | The channel that was attempted to send to. |
message | string | The message text. |
onMessageRemove((channel, messageId, msg) => { /* ... */ })
Fires when a single message is removed from a channel.
Parameter | Type | Description |
---|---|---|
channel | string | The channel where the message was removed. |
messageId | string | The ID of the message that was removed. |
msg | ClearMsg | The full message object containing all message and user information. This is not the message that was removed. The text of the message is available using |
onNoPermission((channel, message) => { /* ... */ })
Fires when you tried to execute a command you don't have sufficient permission for.
Parameter | Type | Description |
---|---|---|
channel | string | The channel that a command without sufficient permissions was executed on. |
message | string | The message text. |
onPart((channel, user) => { /* ... */ })
Fires when a user leaves ("parts") a channel.
The join/part events are cached by the Twitch chat server and will be batched and sent every 30-60 seconds.
Please note that unless you enabled the requestMembershipEvents
option, this will only react to your own parts.
Parameter | Type | Description |
---|---|---|
channel | string | The channel that is being left. |
user | string | The user that left. |
onPrimeCommunityGift((channel, user, subInfo, msg) => { /* ... */ })
Fires when a user gifts a Twitch Prime benefit to the channel.
Parameter | Type | Description |
---|---|---|
channel | string | The channel where the benefit was gifted. |
user | string | The user that received the gift. WARNING: This is a display name and thus will not work as an identifier for the API (login) in some cases. |
subInfo | ChatPrimeCommunityGiftInfo | Additional information about the gift. |
msg | UserNotice | The full message object containing all message and user information. |
onPrimePaidUpgrade((channel, user, subInfo, msg) => { /* ... */ })
Fires when a user upgrades their Prime subscription to a paid subscription in a channel.
Parameter | Type | Description |
---|---|---|
channel | string | The channel where the subscription was upgraded. |
user | string | The user that upgraded their subscription. |
subInfo | ChatSubUpgradeInfo | Additional information about the subscription upgrade. |
msg | UserNotice | The full message object containing all message and user information. |
onPrivmsg((channel, user, message, msg) => { /* ... */ })
Use onMessage
instead.
Fires when a user sends a message to a channel.
Parameter | Type | Description |
---|---|---|
channel | string | The channel the message was sent to. |
user | string | The user that send the message. |
message | string | The message text. |
msg | TwitchPrivateMessage | The full message object containing all message and user information. |
onR9k((channel, enabled) => { /* ... */ })
Fires when R9K mode is toggled in a channel.
Parameter | Type | Description |
---|---|---|
channel | string | The channel where R9K mode is being toggled. |
enabled | boolean | Whether R9K mode is being enabled. If false, it's being disabled. |
onRaid((channel, user, raidInfo, msg) => { /* ... */ })
Fires when a user raids a channel.
Parameter | Type | Description |
---|---|---|
channel | string | The channel that was raided. |
user | string | The user that has raided the channel. |
raidInfo | ChatRaidInfo | Additional information about the raid. |
msg | UserNotice | The full message object containing all message and user information. |
onRaidCancel((channel, msg) => { /* ... */ })
Fires when a user cancels a raid.
Parameter | Type | Description |
---|---|---|
channel | string | The channel where the raid was cancelled. |
msg | UserNotice | The full message object containing all message and user information. |
onResub((channel, user, subInfo, msg) => { /* ... */ })
Fires when a user resubscribes to a channel.
Parameter | Type | Description |
---|---|---|
channel | string | The channel that was resubscribed to. |
user | string | The resubscribing user. |
subInfo | ChatSubInfo | Additional information about the resubscription. |
msg | UserNotice | The full message object containing all message and user information. |
onRewardGift((channel, user, rewardGiftInfo, msg) => { /* ... */ })
Fires when a user gifts rewards during a special event.
Parameter | Type | Description |
---|---|---|
channel | string | The channel where the rewards were gifted. |
user | string | The user that gifted the rewards. |
rewardGiftInfo | ChatRewardGiftInfo | Additional information about the reward gift. |
msg | UserNotice | The full message object containing all message and user information. |
onRitual((channel, user, ritualInfo, msg) => { /* ... */ })
Fires when a user performs a "ritual" in a channel.
Parameter | Type | Description |
---|---|---|
channel | string | The channel where the ritual was performed. |
user | string | The user that has performed the ritual. |
ritualInfo | ChatRitualInfo | Additional information about the ritual. |
msg | UserNotice | The full message object containing all message and user information. |
onSlow((channel, enabled, delay) => { /* ... */ })
Fires when slow mode is toggled in a channel.
Parameter | Type | Description |
---|---|---|
channel | string | The channel where slow mode is being toggled. |
enabled | boolean | Whether slow mode is being enabled. If false, it's being disabled. |
delay | number | The time (in seconds) a user has to wait between sending messages. Only set when enabling slow mode. |
onStandardPayForward((channel, user, forwardInfo, msg) => { /* ... */ })
Fires when a user pays forward a subscription that was gifted to them to a specific user.
Parameter | Type | Description |
---|---|---|
channel | string | The channel where the gift was forwarded. |
user | string | The user that forwarded the gift. |
forwardInfo | ChatStandardPayForwardInfo | Additional information about the gift. |
msg | UserNotice | The full message object containing all message and user information. |
onSub((channel, user, subInfo, msg) => { /* ... */ })
Fires when a user subscribes to a channel.
Parameter | Type | Description |
---|---|---|
channel | string | The channel that was subscribed to. |
user | string | The subscribing user. |
subInfo | ChatSubInfo | Additional information about the subscription. |
msg | UserNotice | The full message object containing all message and user information. |
onSubExtend((channel, user, subInfo, msg) => { /* ... */ })
Fires when a user extends their subscription using a Sub Token.
Parameter | Type | Description |
---|---|---|
channel | string | The channel where the subscription was extended. |
user | string | The user that extended their subscription. |
subInfo | ChatSubExtendInfo | Additional information about the subscription extension. |
msg | UserNotice | The full message object containing all message and user information. |
onSubGift((channel, user, subInfo, msg) => { /* ... */ })
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 Sub gift spam.
Parameter | Type | Description |
---|---|---|
channel | string | The channel that was subscribed to. |
user | string | The user that the subscription was gifted to. The gifting user is defined in |
subInfo | ChatSubGiftInfo | Additional information about the subscription. |
msg | UserNotice | The full message object containing all message and user information. |
onSubsOnly((channel, enabled) => { /* ... */ })
Fires when sub only mode is toggled in a channel.
Parameter | Type | Description |
---|---|---|
channel | string | The channel where sub only mode is being toggled. |
enabled | boolean | Whether sub only mode is being enabled. If false, it's being disabled. |
onTimeout((channel, user, duration) => { /* ... */ })
Fires when a user is timed out from a channel.
Parameter | Type | Description |
---|---|---|
channel | string | The channel the user is timed out from. |
user | string | The timed out user. |
duration | number | The duration of the timeout, in seconds. |
onUnhost((channel) => { /* ... */ })
Fires when host mode is disabled in a channel.
Parameter | Type | Description |
---|---|---|
channel | string | The channel where host mode is being disabled. |
onWhisper((user, message, msg) => { /* ... */ })
Fires when receiving a whisper from another user.
Parameter | Type | Description |
---|---|---|
user | string | The user that sent the whisper. |
message | string | The message text. |
msg | Whisper | The full message object containing all message and user information. |
Properties
onCtcp
Type: (handler: (target: string, user: string, command: string, params: string, msg: PrivateMessage) => void) => Listener
onCtcpReply
Type: (handler: (target: string, user: string, command: string, params: string, msg: Notice) => void) => Listener
onNickChange
Type: (handler: (oldNick: ?string, newNick: string, msg: NickChange) => void) => Listener
onNotice
Type: (handler: (target: string, user: string, message: string, msg: Notice) => void) => Listener
Methods
anonymous(options)
staticCreates a new anonymous Twitch chat client.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
options | ChatClientOptions Aliased type: WebSocketChatClientOptions | TcpChatClientOptions | {} |
forTwitchClient(authProvider, options)
staticUse the ChatClient constructor instead.
Creates a new Twitch chat client with the user info from the AuthProvider instance.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
authProvider | AuthProvider | none | The AuthProvider instance to use for authentication. | |
options | ChatClientOptions Aliased type: WebSocketChatClientOptions | TcpChatClientOptions | {} |
action(channel, message)
asyncSends an action message (/me) to a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | The channel to send the message to. | |
message | string | none | The message to send. |
addListener<Args>(event, listener)
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
event | EventBinder<Args> | none | none | |
listener | EventHandler<Args> | none | none |
addVip(channel, user)
asyncGives a user VIP status in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | The channel to give the user VIP status in. | |
user | string | none | The user to give VIP status. |
addVIP(channel, user)
asyncUse addVip instead.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | none | |
user | string | none | none |
ban(channel, user, reason)
asyncBans a user from a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | ?string | none | The channel to ban the user from. Defaults to the channel of the connected user. | |
user | string | none | The user to ban from the channel. | |
reason | string | "" | The reason for the ban. |
changeColor(color)
asyncChanges your username color.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
color | string | 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, BlueViolet, CadetBlue, Chocolate, Coral, DodgerBlue, Firebrick, GoldenRod, Green, HotPink, OrangeRed, Red, SeaGreen, SpringGreen, YellowGreen |
clear(channel)
asyncClears all messages in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | this._credentials.nick | The channel to ban the user from. Defaults to the channel of the connected user. |
createMessage<T>(type, params, tags)
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
type | MessageConstructor<T> | none | none | |
params | Partial<MessageParamValues<T>> | none | none | |
tags | Record<string, string> | none | none |
deleteMessage(channel, message)
asyncDeletes a message from a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | The channel to delete the message from. | |
message | string | TwitchPrivateMessage | none | The message (as message ID or message object) to delete. |
disableEmoteOnly(channel)
asyncDisables emote-only mode in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | The channel to disable emote-only mode in. |
disableFollowersOnly(channel)
asyncDisables followers-only mode in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | The channel to disable followers-only mode in. |
disableR9k(channel)
asyncDisables r9k mode in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | The channel to disable r9k mode in. |
disableSlow(channel)
asyncDisables slow mode in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | The channel to disable slow mode in. |
disableSubsOnly(channel)
asyncDisables subscribers-only mode in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | The channel to disable subscribers-only mode in. |
enableEmoteOnly(channel)
asyncEnables emote-only mode in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | The channel to enable emote-only mode in. |
enableFollowersOnly(channel, minFollowTime)
asyncEnables followers-only mode in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | 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. |
enableR9k(channel)
asyncEnables r9k mode in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | The channel to enable r9k mode in. |
enableSlow(channel, delayBetweenMessages)
asyncEnables slow mode in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | The channel to enable slow mode in. | |
delayBetweenMessages | number | 30 | The time (in seconds) a user needs to wait between messages. |
enableSubsOnly(channel)
asyncEnables subscribers-only mode in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | The channel to enable subscribers-only mode in. |
getCommandClass(command)
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
command | string | none | none |
getMods(channel)
asyncRetrieves a list of moderators in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | The channel to retrieve the moderators of. |
getVips(channel)
asyncRetrieves a list of VIPs in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | The channel to retrieve the VIPs of. |
getVIPs(channel)
asyncUse getVips instead.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | none |
host(channel, target)
asyncHosts a channel on another channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | ?string | none | The host source, i.e. the channel that is hosting. Defaults to the channel of the connected user. | |
target | string | none | The host target, i.e. the channel that is being hosted. |
join(channel)
asyncJoins a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | The channel to join. |
knowsCommand(command)
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
command | string | none | none |
mod(channel, user)
asyncGives a user moderator rights in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | The channel to give the user moderator rights in. | |
user | string | none | The user to give moderator rights. |
on<Args>(event, listener)
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
event | EventBinder<Args> | none | none | |
listener | EventHandler<Args> | none | none |
onNamedMessage<T>(commandName, handler, handlerName)
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
commandName | string | none | none | |
handler | EventHandler<T> | none | none | |
handlerName | string | none | none |
onTypedMessage<T>(type, handler, handlerName)
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
type | MessageConstructor<T> | none | none | |
handler | EventHandler<T> | none | none | |
handlerName | string | none | none |
part(channel)
Leaves a channel ("part" in IRC terms).
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | The channel to leave. |
purge(channel, user, reason)
asyncRemoves all messages of a user from a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | The channel to purge the user's messages from. | |
user | string | none | The user to purge. | |
reason | string | "" | The reason for the purge. |
raid(channel, target)
asyncStarts a raid on a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | ?string | none | The channel to start the raid in. Defaults to the channel of the connected user. | |
target | string | none | The channel to raid. |
reconnect(message)
asyncParameter | Type | Required | Default | Description |
---|---|---|---|---|
message | string | none | none |
registerCapability(cap)
asyncParameter | Type | Required | Default | Description |
---|---|---|---|---|
cap | Capability | none | none |
registerMessageType(cls)
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
cls | MessageConstructor | none | none |
removeListener(event, listener)
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
event | Function | none | none | |
listener | Function | none | none |
removeMessageListener(handlerName)
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
handlerName | string | none | none |
removeVip(channel, user)
asyncTakes VIP status from a user in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | The channel to remove the user's VIP status in. | |
user | string | none | The user to take VIP status from. |
removeVIP(channel, user)
asyncUse removeVip instead.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | none | |
user | string | none | none |
runCommercial(channel, duration)
asyncRuns a commercial break on a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | The channel to run the commercial break on. | |
duration | CommercialLength The possible lengths of a channel commercial. Aliased type: 30 | 60 | 90 | 120 | 150 | 180 | none | The duration of the commercial break. |
say(channel, message, attributes)
asyncSends a message to a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | The channel to send the message to. | |
message | string | none | The message to send. | |
attributes | ChatSayMessageAttributes | {} | The attributes to add to the message. |
sendCtcp(target, type, message)
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
target | string | none | none | |
type | string | none | none | |
message | string | none | none |
sendMessage<T>(type, params, tags)
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
type | MessageConstructor<T> | none | none | |
params | Partial<MessageParamValues<T>> | none | none | |
tags | Record<string, string> | none | none |
sendMessageAndCaptureReply<T>(type, params)
asyncParameter | Type | Required | Default | Description |
---|---|---|---|---|
type | MessageConstructor<T> | none | none | |
params | Partial<MessageParamValues<T>> | none | none |
timeout(channel, user, duration, reason)
asyncTimes out a user in a channel and removes all their messages.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | The channel to time out the user in. | |
user | string | 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 | "" |
unhost(channel)
asyncEnds any host on a channel.
This only works when in the channel that was hosted in order to provide feedback about success of the command.
If you don't need this feedback, consider using ChatClient#unhostOutside instead.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | this._credentials.nick | The channel to end the host on. Defaults to the channel of the connected user. |
unhostOutside(channel)
asyncEnds any host on a channel.
This works even when not in the channel that was hosted, but provides no feedback about success of the command.
If you need feedback about success, use ChatClient#unhost (but make sure you're in the channel you are hosting).
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | this._credentials.nick | The channel to end the host on. Defaults to the channel of the connected user. |
unmod(channel, user)
asyncTakes moderator rights from a user in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | string | none | The channel to remove the user's moderator rights in. | |
user | string | none | The user to take moderator rights from. |
unraid(channel)
asyncEnds a raid on a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | ?string | none | The channel to end the raid in. Defaults to the channel of the connected user. |
waitForRegistration()
asyncUse the onRegister
event instead. To join channels after connecting, use the channels
option.
Waits for authentication (or "registration" in IRC terms) to finish.
whisper(user, message)
asyncSends a whisper message to another user.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
user | string | none | The user to send the message to. | |
message | string | none | The message to send. |