UNPKG

@twurple/eventsub-base

Version:

Base for the other Twurple EventSub packages

83 lines (82 loc) 3.01 kB
import { __decorate } from "tslib"; import { Enumerable } from '@d-fischer/shared-utils'; import { checkRelationAssertion, DataObject, rawDataSymbol, rtfm } from '@twurple/common'; import { EventSubChannelSharedChatSessionParticipant } from './common/EventSubChannelSharedChatSessionParticipant.js'; /** * An EventSub event representing an update to a shared chat session in a channel. */ let EventSubChannelSharedChatSessionUpdateEvent = class EventSubChannelSharedChatSessionUpdateEvent extends DataObject { /** @internal */ _client; /** @internal */ constructor(data, client) { super(data); this._client = client; } /** * The unique identifier for the shared chat session. */ get sessionId() { return this[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[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[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[rawDataSymbol].broadcaster_user_name; } /** * Gets information about the broadcaster. */ async getBroadcaster() { return checkRelationAssertion(await this._client.users.getUserById(this[rawDataSymbol].broadcaster_user_id)); } /** * The ID of the host broadcaster. */ get hostBroadcasterId() { return this[rawDataSymbol].host_broadcaster_user_id; } /** * The name of the host broadcaster. */ get hostBroadcasterName() { return this[rawDataSymbol].host_broadcaster_user_login; } /** * The display name of the host broadcaster. */ get hostBroadcasterDisplayName() { return this[rawDataSymbol].host_broadcaster_user_name; } /** * Gets information about the broadcaster. */ async getHostBroadcaster() { return checkRelationAssertion(await this._client.users.getUserById(this[rawDataSymbol].host_broadcaster_user_id)); } /** * The list of participants in the session. */ get participants() { return this[rawDataSymbol].participants.map(participant => new EventSubChannelSharedChatSessionParticipant(participant, this._client)); } }; __decorate([ Enumerable(false) ], EventSubChannelSharedChatSessionUpdateEvent.prototype, "_client", void 0); EventSubChannelSharedChatSessionUpdateEvent = __decorate([ rtfm('eventsub-base', 'EventSubChannelSharedChatSessionUpdateEvent', 'broadcasterId') ], EventSubChannelSharedChatSessionUpdateEvent); export { EventSubChannelSharedChatSessionUpdateEvent };