UNPKG

@twurple/eventsub-base

Version:

Base for the other Twurple EventSub packages

50 lines (49 loc) 1.62 kB
import { __decorate } from "tslib"; import { rawDataSymbol, rtfm } from '@twurple/common'; import { EventSubChannelBaseModerationEvent } from './EventSubChannelBaseModerationEvent.js'; /** * An EventSub event representing a moderator warning a user in a channel. */ let EventSubChannelWarnModerationEvent = class EventSubChannelWarnModerationEvent extends EventSubChannelBaseModerationEvent { 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() { return this[rawDataSymbol].warn.chat_rules_cited ?? []; } }; EventSubChannelWarnModerationEvent = __decorate([ rtfm('eventsub-base', 'EventSubChannelWarnModerationEvent', 'broadcasterId') ], EventSubChannelWarnModerationEvent); export { EventSubChannelWarnModerationEvent };