UNPKG

@twurple/eventsub-base

Version:

Base for the other Twurple EventSub packages

32 lines (31 loc) 1.31 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 new EventSubChannelChatClearEvent(data, this._client._apiClient); } async _subscribe() { return await this._client._apiClient.asUser(this._userId, async (ctx) => await ctx.eventSub.subscribeToChannelChatClearEvents(this._broadcasterId, await this._getTransportOptions())); } }; EventSubChannelChatClearSubscription = __decorate([ rtfm('eventsub-base', 'EventSubSubscription') ], EventSubChannelChatClearSubscription); export { EventSubChannelChatClearSubscription };