@twurple/eventsub-base
Version:
Base for the other Twurple EventSub packages
46 lines (45 loc) • 1.59 kB
JavaScript
import { __decorate } from "tslib";
import { Enumerable } from '@d-fischer/shared-utils';
import { checkRelationAssertion, DataObject, rawDataSymbol, rtfm } from '@twurple/common';
/**
* Represents a broadcaster participating in a shared chat session.
*/
let EventSubChannelSharedChatSessionParticipant = class EventSubChannelSharedChatSessionParticipant extends DataObject {
/** @internal */ _client;
/** @internal */
constructor(data, client) {
super(data);
this._client = client;
}
/**
* The ID of the participant broadcaster.
*/
get broadcasterId() {
return this[rawDataSymbol].broadcaster_user_id;
}
/**
* The name of the participant broadcaster.
*/
get broadcasterName() {
return this[rawDataSymbol].broadcaster_user_login;
}
/**
* The display name of the participant broadcaster.
*/
get broadcasterDisplayName() {
return this[rawDataSymbol].broadcaster_user_name;
}
/**
* Gets information about the participant broadcaster.
*/
async getBroadcaster() {
return checkRelationAssertion(await this._client.users.getUserById(this[rawDataSymbol].broadcaster_user_id));
}
};
__decorate([
Enumerable(false)
], EventSubChannelSharedChatSessionParticipant.prototype, "_client", void 0);
EventSubChannelSharedChatSessionParticipant = __decorate([
rtfm('eventsub-base', 'EventSubChannelSharedChatSessionParticipant', 'broadcasterId')
], EventSubChannelSharedChatSessionParticipant);
export { EventSubChannelSharedChatSessionParticipant };