UNPKG

@twurple/eventsub-base

Version:

Base for the other Twurple EventSub packages

36 lines (35 loc) 1.65 kB
import { __decorate } from "tslib"; import { rtfm } from '@twurple/common'; import { EventSubChannelSuspiciousUserMessageEvent } from '../events/EventSubChannelSuspiciousUserMessageEvent.js'; import { EventSubSubscription } from './EventSubSubscription.js'; /** @internal */ let EventSubChannelSuspiciousUserMessageSubscription = class EventSubChannelSuspiciousUserMessageSubscription extends EventSubSubscription { _broadcasterId; _moderatorId; /** @protected */ _cliName = ''; constructor(handler, client, _broadcasterId, _moderatorId) { super(handler, client); this._broadcasterId = _broadcasterId; this._moderatorId = _moderatorId; } get id() { return `channel.suspicious_user.message.${this._broadcasterId}.${this._moderatorId}`; } get authUserId() { return this._moderatorId; } transformData(data) { return this._client._config.managed ? new EventSubChannelSuspiciousUserMessageEvent(data, this._client._config.apiClient) : new EventSubChannelSuspiciousUserMessageEvent(data); } async _subscribe() { return this._client._config.managed ? await this._client._config.apiClient.asUser(this._moderatorId, async (ctx) => await ctx.eventSub.subscribeToChannelSuspiciousUserMessageEvents(this._broadcasterId, await this._getTransportOptions())) : undefined; } }; EventSubChannelSuspiciousUserMessageSubscription = __decorate([ rtfm('eventsub-base', 'EventSubSubscription') ], EventSubChannelSuspiciousUserMessageSubscription); export { EventSubChannelSuspiciousUserMessageSubscription };