@twurple/eventsub-base
Version:
Base for the other Twurple EventSub packages
50 lines (49 loc) • 1.57 kB
JavaScript
import { __decorate } from "tslib";
import { rawDataSymbol, rtfm } from '@twurple/common';
import { EventSubChannelBaseModerationEvent } from './EventSubChannelBaseModerationEvent.js';
/**
* An EventSub event representing a moderator timing out a user on a channel.
*/
let EventSubChannelTimeoutModerationEvent = class EventSubChannelTimeoutModerationEvent extends EventSubChannelBaseModerationEvent {
moderationAction = 'timeout';
/**
* The ID of the user being timed out.
*/
get userId() {
return this[rawDataSymbol].timeout.user_id;
}
/**
* The name of the user being timed out.
*/
get userName() {
return this[rawDataSymbol].timeout.user_login;
}
/**
* The display name of the user being timed out.
*/
get userDisplayName() {
return this[rawDataSymbol].timeout.user_name;
}
/**
* Gets more information about the user.
*/
async getUser() {
return await this._client.users.getUserById(this[rawDataSymbol].timeout.user_id);
}
/**
* The reason given for the timeout.
*/
get reason() {
return this[rawDataSymbol].timeout.reason;
}
/**
* The time at which the timeout ends.
*/
get expiryDate() {
return new Date(this[rawDataSymbol].timeout.expires_at);
}
};
EventSubChannelTimeoutModerationEvent = __decorate([
rtfm('eventsub-base', 'EventSubChannelTimeoutModerationEvent', 'broadcasterId')
], EventSubChannelTimeoutModerationEvent);
export { EventSubChannelTimeoutModerationEvent };