UNPKG

@twurple/eventsub-base

Version:

Base for the other Twurple EventSub packages

34 lines (33 loc) 1.42 kB
import { __decorate } from "tslib"; import { rtfm } from '@twurple/common'; import { EventSubChannelHypeTrainBeginV2Event } from '../events/EventSubChannelHypeTrainBeginV2Event.js'; import { EventSubSubscription } from './EventSubSubscription.js'; /** @internal */ let EventSubChannelHypeTrainBeginV2Subscription = class EventSubChannelHypeTrainBeginV2Subscription extends EventSubSubscription { _userId; /** @protected */ _cliName = 'hype-train-begin'; constructor(handler, client, _userId) { super(handler, client); this._userId = _userId; } get id() { return `channel.hype_train.begin.v2.${this._userId}`; } get authUserId() { return this._userId; } transformData(data) { return this._client._config.managed ? new EventSubChannelHypeTrainBeginV2Event(data, this._client._config.apiClient) : new EventSubChannelHypeTrainBeginV2Event(data); } async _subscribe() { return this._client._config.managed ? await this._client._config.apiClient.eventSub.subscribeToChannelHypeTrainBeginV2Events(this._userId, await this._getTransportOptions()) : undefined; } }; EventSubChannelHypeTrainBeginV2Subscription = __decorate([ rtfm('eventsub-base', 'EventSubSubscription') ], EventSubChannelHypeTrainBeginV2Subscription); export { EventSubChannelHypeTrainBeginV2Subscription };