@twurple/eventsub-base
Version:
Base for the other Twurple EventSub packages
85 lines (84 loc) • 3.4 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventSubChannelSharedChatSessionUpdateEvent = 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 an update to a shared chat session in a channel.
*/
let EventSubChannelSharedChatSessionUpdateEvent = class EventSubChannelSharedChatSessionUpdateEvent 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 participants in the session.
*/
get participants() {
return this[common_1.rawDataSymbol].participants.map(participant => new EventSubChannelSharedChatSessionParticipant_1.EventSubChannelSharedChatSessionParticipant(participant, this._client));
}
};
exports.EventSubChannelSharedChatSessionUpdateEvent = EventSubChannelSharedChatSessionUpdateEvent;
tslib_1.__decorate([
(0, shared_utils_1.Enumerable)(false)
], EventSubChannelSharedChatSessionUpdateEvent.prototype, "_client", void 0);
exports.EventSubChannelSharedChatSessionUpdateEvent = EventSubChannelSharedChatSessionUpdateEvent = tslib_1.__decorate([
(0, common_1.rtfm)('eventsub-base', 'EventSubChannelSharedChatSessionUpdateEvent', 'broadcasterId')
], EventSubChannelSharedChatSessionUpdateEvent);