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.

ParameterTypeRequiredDefaultDescription
paramsobjectnonesee below
params.logLevelLogLevelLogLevel.WARNINGnone
params.loggerPartial<LoggerOptions>nonenone
params.pubSubClientBasicPubSubClientnonenone
params.twitchClientApiClientnonenone

Methods

onAutoModQueue(channel, callback)

async

Adds a listener to AutoMod queue events to the client.

ParameterTypeRequiredDefaultDescription
channelUserIdResolvablenone

The channel to listen to.

callback(message: PubSubAutoModQueueMessage) => voidnone

A function to be called when an AutoMod queue event is sent to the user.

It receives a PubSubAutoModQueueMessage object.

Return type: PubSubListener<never>

onBits(callback)

async

Adds a listener to bits events to the client.

ParameterTypeRequiredDefaultDescription
callback(message: PubSubBitsMessage) => voidnone

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.

ParameterTypeRequiredDefaultDescription
callback(message: PubSubBitsBadgeUnlockMessage) => voidnone

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>

onModAction(channel, callback)

async

Adds a listener to mod action events to the client.

ParameterTypeRequiredDefaultDescription
channelUserIdResolvablenone

The channel to listen to.

callback(message: PubSubChatModActionMessage) => voidnone

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.

ParameterTypeRequiredDefaultDescription
callback(message: PubSubRedemptionMessage) => voidnone

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.

ParameterTypeRequiredDefaultDescription
callback(message: PubSubSubscriptionMessage) => voidnone

A function to be called when a subscription event happens in the user's channel.

It receives a PubSubSubscriptionMessage object.

Return type: PubSubListener<never>

onUserModeration(channel, callback)

async

Adds a listener to user moderation events to the client.

ParameterTypeRequiredDefaultDescription
channelUserIdResolvablenone

The channel to listen to.

callback(message: PubSubSubscriptionMessage) => voidnone

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

It receives a PubSubUserModerationNotificationMessage object.

Return type: PubSubListener<never>

onWhisper(callback)

async

Adds a listener to whisper events to the client.

ParameterTypeRequiredDefaultDescription
callback(message: PubSubWhisperMessage) => voidnone

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.

ParameterTypeRequiredDefaultDescription
listenerPubSubListener<never>none

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

Return type: void