@twurple/eventsub-base
Version:
Base for the other Twurple EventSub packages
56 lines (55 loc) • 1.96 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventSubChannelTimeoutModerationEvent = void 0;
const tslib_1 = require("tslib");
const common_1 = require("@twurple/common");
const EventSubChannelBaseModerationEvent_1 = require("./EventSubChannelBaseModerationEvent");
/**
* An EventSub event representing a moderator timing out a user on a channel.
*/
let EventSubChannelTimeoutModerationEvent = class EventSubChannelTimeoutModerationEvent extends EventSubChannelBaseModerationEvent_1.EventSubChannelBaseModerationEvent {
constructor() {
super(...arguments);
this.moderationAction = 'timeout';
}
/**
* The ID of the user being timed out.
*/
get userId() {
return this[common_1.rawDataSymbol].timeout.user_id;
}
/**
* The name of the user being timed out.
*/
get userName() {
return this[common_1.rawDataSymbol].timeout.user_login;
}
/**
* The display name of the user being timed out.
*/
get userDisplayName() {
return this[common_1.rawDataSymbol].timeout.user_name;
}
/**
* Gets more information about the user.
*/
async getUser() {
return await this._client.users.getUserById(this[common_1.rawDataSymbol].timeout.user_id);
}
/**
* The reason given for the timeout.
*/
get reason() {
return this[common_1.rawDataSymbol].timeout.reason;
}
/**
* The time at which the timeout ends.
*/
get expiryDate() {
return new Date(this[common_1.rawDataSymbol].timeout.expires_at);
}
};
exports.EventSubChannelTimeoutModerationEvent = EventSubChannelTimeoutModerationEvent;
exports.EventSubChannelTimeoutModerationEvent = EventSubChannelTimeoutModerationEvent = tslib_1.__decorate([
(0, common_1.rtfm)('eventsub-base', 'EventSubChannelTimeoutModerationEvent', 'broadcasterId')
], EventSubChannelTimeoutModerationEvent);