UNPKG

@twurple/eventsub-base

Version:

Base for the other Twurple EventSub packages

85 lines (84 loc) 3.41 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EventSubChannelSharedChatSessionBeginEvent = void 0; const tslib_1 = require("tslib"); const shared_utils_1 = require("@d-fischer/shared-utils"); const common_1 = require("@twurple/common"); const EventSubChannelSharedChatSessionParticipant_1 = require("./common/EventSubChannelSharedChatSessionParticipant"); /** * An EventSub event representing the start of a shared chat session in a channel. */ let EventSubChannelSharedChatSessionBeginEvent = class EventSubChannelSharedChatSessionBeginEvent extends common_1.DataObject { /** @internal */ constructor(data, client) { super(data); this._client = client; } /** * The unique identifier for the shared chat session. */ get sessionId() { return this[common_1.rawDataSymbol].session_id; } /** * The ID of the broadcaster in the subscription condition which is now active in the shared chat session. */ get broadcasterId() { return this[common_1.rawDataSymbol].broadcaster_user_id; } /** * The name of the broadcaster in the subscription condition which is now active in the shared chat session. */ get broadcasterName() { return this[common_1.rawDataSymbol].broadcaster_user_login; } /** * The display name of the broadcaster in the subscription condition which is now active in the shared chat session. */ get broadcasterDisplayName() { return this[common_1.rawDataSymbol].broadcaster_user_name; } /** * Gets information about the broadcaster. */ async getBroadcaster() { return (0, common_1.checkRelationAssertion)(await this._client.users.getUserById(this[common_1.rawDataSymbol].broadcaster_user_id)); } /** * The ID of the host broadcaster. */ get hostBroadcasterId() { return this[common_1.rawDataSymbol].host_broadcaster_user_id; } /** * The name of the host broadcaster. */ get hostBroadcasterName() { return this[common_1.rawDataSymbol].host_broadcaster_user_login; } /** * The display name of the host broadcaster. */ get hostBroadcasterDisplayName() { return this[common_1.rawDataSymbol].host_broadcaster_user_name; } /** * Gets information about the broadcaster. */ async getHostBroadcaster() { return (0, common_1.checkRelationAssertion)(await this._client.users.getUserById(this[common_1.rawDataSymbol].host_broadcaster_user_id)); } /** * The list of all participants currently in the shared chat session. */ get participants() { return this[common_1.rawDataSymbol].participants.map(participant => new EventSubChannelSharedChatSessionParticipant_1.EventSubChannelSharedChatSessionParticipant(participant, this._client)); } }; exports.EventSubChannelSharedChatSessionBeginEvent = EventSubChannelSharedChatSessionBeginEvent; tslib_1.__decorate([ (0, shared_utils_1.Enumerable)(false) ], EventSubChannelSharedChatSessionBeginEvent.prototype, "_client", void 0); exports.EventSubChannelSharedChatSessionBeginEvent = EventSubChannelSharedChatSessionBeginEvent = tslib_1.__decorate([ (0, common_1.rtfm)('eventsub-base', 'EventSubChannelSharedChatSessionBeginEvent', 'broadcasterId') ], EventSubChannelSharedChatSessionBeginEvent);