UNPKG

@twurple/eventsub-base

Version:

Base for the other Twurple EventSub packages

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