Overview
Constructor
new SingleUserPubSubClient(params)
Creates a new Twitch PubSub client.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
params | object | none | see below | |
params.logLevel | LogLevel | LogLevel.WARNING | none | |
params.logger | Partial<LoggerOptions> | none | none | |
params.pubSubClient | BasicPubSubClient | none | none | |
params.twitchClient | ApiClient | none | none |
Methods
onAutoModQueue(channel, callback)
asyncAdds a listener to AutoMod queue events to the client.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | UserIdResolvable | none | The channel to listen to. | |
callback | (message: PubSubAutoModQueueMessage) => void | none | A function to be called when an AutoMod queue event is sent to the user. It receives a PubSubAutoModQueueMessage object. |
onBits(callback)
asyncAdds a listener to bits events to the client.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
callback | (message: PubSubBitsMessage) => void | none | A function to be called when a bits event happens in the user's channel. It receives a PubSubBitsMessage object. |
onBitsBadgeUnlock(callback)
asyncAdds a listener to bits badge unlock events to the client.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
callback | (message: PubSubBitsBadgeUnlockMessage) => void | none | A function to be called when a bit badge is unlocked in the user's channel. It receives a PubSubBitsBadgeUnlockMessage object. |
onModAction(channel, callback)
asyncAdds a listener to mod action events to the client.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | UserIdResolvable | none | The channel to listen to. | |
callback | (message: PubSubChatModActionMessage) => void | none | A function to be called when a mod action event is sent to the user. It receives a PubSubChatModActionMessage object. |
onRedemption(callback)
asyncAdds a listener to redemption events to the client.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
callback | (message: PubSubRedemptionMessage) => void | none | A function to be called when a channel point reward is redeemed in the user's channel. It receives a PubSubRedemptionMessage object. |
onSubscription(callback)
asyncAdds a listener to subscription events to the client.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
callback | (message: PubSubSubscriptionMessage) => void | none | A function to be called when a subscription event happens in the user's channel. It receives a PubSubSubscriptionMessage object. |
onUserModeration(channel, callback)
asyncAdds a listener to user moderation events to the client.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
channel | UserIdResolvable | none | The channel to listen to. | |
callback | (message: PubSubSubscriptionMessage) => void | none | A function to be called when a user moderation event is sent to the user. It receives a PubSubUserModerationNotificationMessage object. |
onWhisper(callback)
asyncAdds a listener to whisper events to the client.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
callback | (message: PubSubWhisperMessage) => void | none | A function to be called when a whisper is sent to the user. It receives a PubSubWhisperMessage object. |
removeListener(listener)
asyncRemoves a listener from the client.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
listener | PubSubListener<never> | none | A listener returned by one of the |