UNPKG

@twurple/eventsub-base

Version:

Base for the other Twurple EventSub packages

30 lines (29 loc) 1.33 kB
import { __decorate } from "tslib"; import { rtfm } from '@twurple/common'; import { EventSubSubscription } from "./EventSubSubscription.mjs"; import { EventSubChannelWarningSendEvent } from "../events/EventSubChannelWarningSendEvent.mjs"; /** @internal */ let EventSubChannelWarningSendSubscription = class EventSubChannelWarningSendSubscription extends EventSubSubscription { constructor(handler, client, _broadcasterId, _moderatorId) { super(handler, client); this._broadcasterId = _broadcasterId; this._moderatorId = _moderatorId; /** @protected */ this._cliName = ''; } get id() { return `channel.warning.send.${this._broadcasterId}.${this._moderatorId}`; } get authUserId() { return this._moderatorId; } transformData(data) { return new EventSubChannelWarningSendEvent(data, this._client._apiClient); } async _subscribe() { return await this._client._apiClient.asUser(this._moderatorId, async (ctx) => await ctx.eventSub.subscribeToChannelWarningSendEvents(this._broadcasterId, await this._getTransportOptions())); } }; EventSubChannelWarningSendSubscription = __decorate([ rtfm('eventsub-base', 'EventSubSubscription') ], EventSubChannelWarningSendSubscription); export { EventSubChannelWarningSendSubscription };