@twurple/eventsub-base
Version:
Base for the other Twurple EventSub packages
54 lines (53 loc) • 1.74 kB
JavaScript
import { __decorate } from "tslib";
import { rawDataSymbol, rtfm } from '@twurple/common';
import { EventSubChannelBaseModerationEvent } from "./EventSubChannelBaseModerationEvent.mjs";
/**
* An EventSub event representing a moderator warning a user in a channel.
*/
let EventSubChannelWarnModerationEvent = class EventSubChannelWarnModerationEvent extends EventSubChannelBaseModerationEvent {
constructor() {
super(...arguments);
this.moderationAction = 'warn';
}
/**
* The ID of the user being warned.
*/
get userId() {
return this[rawDataSymbol].warn.user_id;
}
/**
* The name of the user being warned.
*/
get userName() {
return this[rawDataSymbol].warn.user_login;
}
/**
* The display name of the user being warned.
*/
get userDisplayName() {
return this[rawDataSymbol].warn.user_name;
}
/**
* Gets more information about the user.
*/
async getUser() {
return await this._client.users.getUserById(this[rawDataSymbol].warn.user_id);
}
/**
* The reason given for the warning, or `null` if no reason was specified.
*/
get reason() {
return this[rawDataSymbol].warn.reason;
}
/**
* The chat rules cited for the warning. This will be an empty array if no rules are cited.
*/
get chatRulesCited() {
var _a;
return (_a = this[rawDataSymbol].warn.chat_rules_cited) !== null && _a !== void 0 ? _a : [];
}
};
EventSubChannelWarnModerationEvent = __decorate([
rtfm('eventsub-base', 'EventSubChannelWarnModerationEvent', 'broadcasterId')
], EventSubChannelWarnModerationEvent);
export { EventSubChannelWarnModerationEvent };