@twurple/eventsub-base
Version:
Base for the other Twurple EventSub packages
76 lines (75 loc) • 2.63 kB
JavaScript
import { __decorate } from "tslib";
import { Enumerable } from '@d-fischer/shared-utils';
import { checkRelationAssertion, DataObject, rawDataSymbol, rtfm } from '@twurple/common';
/**
* An EventSub event representing the end of a shared chat session in a channel.
*/
let EventSubChannelSharedChatSessionEndEvent = class EventSubChannelSharedChatSessionEndEvent 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));
}
};
__decorate([
Enumerable(false)
], EventSubChannelSharedChatSessionEndEvent.prototype, "_client", void 0);
EventSubChannelSharedChatSessionEndEvent = __decorate([
rtfm('eventsub-base', 'EventSubChannelSharedChatSessionEndEvent', 'broadcasterId')
], EventSubChannelSharedChatSessionEndEvent);
export { EventSubChannelSharedChatSessionEndEvent };