Overview
Constructor
new SingleUserPubSubClient(params)
Creates a new Twitch PubSub client.
Parameter | Type | Description |
---|---|---|
params | object | see below |
params.logLevel | LogLevel | none |
params.logger | Partial<LoggerOptions> | none |
params.pubSubClient | BasicPubSubClient | none |
params.twitchClient | ApiClient | none |
Methods
onBits(callback)
asyncAdds a listener to bits events to the client.
Parameter | Type | Description |
---|---|---|
callback | (message: PubSubBitsMessage) => void | 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 | Description |
---|---|---|
callback | (message: PubSubBitsBadgeUnlockMessage) => void | A function to be called when a bit badge is unlocked in the user's channel. It receives a PubSubBitsBadgeUnlockMessage object. |
onModAction(channelId, callback)
asyncAdds a listener to mod action events to the client.
Parameter | Type | Description |
---|---|---|
channelId | UserIdResolvable | The ID of the channel to listen to. |
callback | (message: PubSubChatModActionMessage) => void | 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 | Description |
---|---|---|
callback | (message: PubSubRedemptionMessage) => void | 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 | Description |
---|---|---|
callback | (message: PubSubSubscriptionMessage) => void | A function to be called when a subscription event happens in the user's channel. It receives a PubSubSubscriptionMessage object. |
onWhisper(callback)
asyncAdds a listener to whisper events to the client.
Parameter | Type | Description |
---|---|---|
callback | (message: PubSubWhisperMessage) => void | 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 | Description |
---|---|---|
listener | PubSubListener<never> | A listener returned by one of the |