@twurple/eventsub-base
Version:
Base for the other Twurple EventSub packages
90 lines (89 loc) • 3.11 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventSubChannelUnbanRequestCreateEvent = void 0;
const tslib_1 = require("tslib");
const shared_utils_1 = require("@d-fischer/shared-utils");
const common_1 = require("@twurple/common");
/**
* An EventSub event representing an unban request in a channel.
*/
let EventSubChannelUnbanRequestCreateEvent = class EventSubChannelUnbanRequestCreateEvent extends common_1.DataObject {
/** @internal */
constructor(data, client) {
super(data);
this._client = client;
}
/**
* The ID of the unban request.
*/
get id() {
return this[common_1.rawDataSymbol].id;
}
/**
* The ID of the broadcaster in which channel the unban request was created.
*/
get broadcasterId() {
return this[common_1.rawDataSymbol].broadcaster_user_id;
}
/**
* The name of the broadcaster in which channel the unban request was created.
*/
get broadcasterName() {
return this[common_1.rawDataSymbol].broadcaster_user_login;
}
/**
* The display name of the broadcaster in which channel the unban request was created.
*/
get broadcasterDisplayName() {
return this[common_1.rawDataSymbol].broadcaster_user_name;
}
/**
* Gets more information about the broadcaster in which channel the unban request was created.
*/
async getBroadcaster() {
return (0, common_1.checkRelationAssertion)(await this._client.users.getUserById(this[common_1.rawDataSymbol].broadcaster_user_id));
}
/**
* The ID of the user that is requesting to be unbanned.
*/
get userId() {
return this[common_1.rawDataSymbol].user_id;
}
/**
* The name of the user that is requesting to be unbanned.
*/
get userName() {
return this[common_1.rawDataSymbol].user_login;
}
/**
* The display name of the user that is requesting to be unbanned.
*/
get userDisplayName() {
return this[common_1.rawDataSymbol].user_name;
}
/**
* Gets more information about the user that requested to be unbanned.
*/
async getUser() {
return (0, common_1.checkRelationAssertion)(await this._client.users.getUserById(this[common_1.rawDataSymbol].user_id));
}
/**
* The message sent in the unban request.
*/
get message() {
return this[common_1.rawDataSymbol].text;
}
/**
* Date when the unban request was created.
*/
get creationDate() {
return new Date(this[common_1.rawDataSymbol].created_at);
}
};
exports.EventSubChannelUnbanRequestCreateEvent = EventSubChannelUnbanRequestCreateEvent;
tslib_1.__decorate([
(0, shared_utils_1.Enumerable)(false)
], EventSubChannelUnbanRequestCreateEvent.prototype, "_client", void 0);
exports.EventSubChannelUnbanRequestCreateEvent = EventSubChannelUnbanRequestCreateEvent = tslib_1.__decorate([
(0, common_1.rtfm)('eventsub-base', 'EventSubChannelUnbanRequestCreateEvent', 'id')
], EventSubChannelUnbanRequestCreateEvent);