twitcheasy-twitch-bottwitch-authtwitch-auth-tmitwitch-chat-clienttwitch-eventsubtwitch-pubsub-clienttwitch-webhooks

SingleUserPubSubClient

A higher level PubSub client attached to a single user.

Overview

Constructor

new SingleUserPubSubClient(params)

Creates a new Twitch PubSub client.

Parameter Type Required Default Description
params object none see below
params.authProvider AuthProvider none none
params.logger Partial<LoggerOptions> none none
params.pubSubClient BasicPubSubClient none none

Methods

onBits(callback)

async

Adds 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.

Return type: PubSubListener<never>

onBitsBadgeUnlock(callback)

async

Adds 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.

Return type: PubSubListener<never>

onCustomTopic(topic, callback, scope, channelId)

async

Adds a listener for arbitrary/undocumented events to the client.

Parameter Type Required Default Description
topic string none

The topic to subscribe to.

callback (message: PubSubCustomMessage) => void none

A function to be called when a custom event is sent to the user.

It receives a PubSubCustomMessage object.

scope string none

An optional scope if the topic requires it.

channelId UserIdResolvable none

The ID of the channel to listen to, if the topic requires it.

Return type: PubSubListener<never>

onModAction(channelId, callback)

async

Adds a listener to mod action events to the client.

Parameter Type Required Default Description
channelId UserIdResolvable none

The ID of 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.

Return type: PubSubListener<never>

onRedemption(callback)

async

Adds 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.

Return type: PubSubListener<never>

onSubscription(callback)

async

Adds 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.

Return type: PubSubListener<never>

onWhisper(callback)

async

Adds 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.

Return type: PubSubListener<never>

removeListener(listener)

async

Removes a listener from the client.

Parameter Type Required Default Description
listener PubSubListener<never> none

A listener returned by one of the add*Listener methods.

Return type: void