UNPKG

@twurple/eventsub-base

Version:

Base for the other Twurple EventSub packages

57 lines (56 loc) 2.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EventSubChannelWarnModerationEvent = void 0; const tslib_1 = require("tslib"); const common_1 = require("@twurple/common"); const EventSubChannelBaseModerationEvent_1 = require("./EventSubChannelBaseModerationEvent"); /** * An EventSub event representing a moderator warning a user in a channel. */ let EventSubChannelWarnModerationEvent = class EventSubChannelWarnModerationEvent extends EventSubChannelBaseModerationEvent_1.EventSubChannelBaseModerationEvent { constructor() { super(...arguments); this.moderationAction = 'warn'; } /** * The ID of the user being warned. */ get userId() { return this[common_1.rawDataSymbol].warn.user_id; } /** * The name of the user being warned. */ get userName() { return this[common_1.rawDataSymbol].warn.user_login; } /** * The display name of the user being warned. */ get userDisplayName() { return this[common_1.rawDataSymbol].warn.user_name; } /** * Gets more information about the user. */ async getUser() { return await this._client.users.getUserById(this[common_1.rawDataSymbol].warn.user_id); } /** * The reason given for the warning, or `null` if no reason was specified. */ get reason() { return this[common_1.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[common_1.rawDataSymbol].warn.chat_rules_cited) !== null && _a !== void 0 ? _a : []; } }; exports.EventSubChannelWarnModerationEvent = EventSubChannelWarnModerationEvent; exports.EventSubChannelWarnModerationEvent = EventSubChannelWarnModerationEvent = tslib_1.__decorate([ (0, common_1.rtfm)('eventsub-base', 'EventSubChannelWarnModerationEvent', 'broadcasterId') ], EventSubChannelWarnModerationEvent);