UNPKG

@twurple/eventsub-base

Version:

Base for the other Twurple EventSub packages

112 lines (111 loc) 3.45 kB
import { __decorate } from "tslib"; import { Enumerable } from '@d-fischer/shared-utils'; import { checkRelationAssertion, DataObject, rawDataSymbol, rtfm } from '@twurple/common'; /** * An EventSub event representing a message sent by a suspicious user in a channel. */ let EventSubChannelSuspiciousUserMessageEvent = class EventSubChannelSuspiciousUserMessageEvent extends DataObject { /** @internal */ _client; /** @internal */ constructor(data, client) { super(data); this._client = client; } /** * The ID of the channel in which a suspicious user sent the message. */ get broadcasterId() { return this[rawDataSymbol].broadcaster_user_id; } /** * The name of the channel in which a suspicious user sent the message. */ get broadcasterName() { return this[rawDataSymbol].broadcaster_user_login; } /** * The display name of the channel in which a suspicious user sent the message. */ get broadcasterDisplayName() { return this[rawDataSymbol].broadcaster_user_name; } /** * Gets more information about the broadcaster. */ async getBroadcaster() { return checkRelationAssertion(await this._client.users.getUserById(this[rawDataSymbol].broadcaster_user_id)); } /** * The ID of the user who sent the message. */ get userId() { return this[rawDataSymbol].user_id; } /** * The name of the user who sent the message. */ get userName() { return this[rawDataSymbol].user_login; } /** * The display name of the user who sent the message. */ get userDisplayName() { return this[rawDataSymbol].user_name; } /** * Gets more information about the user whose treatment was updated. */ async getUser() { return checkRelationAssertion(await this._client.users.getUserById(this[rawDataSymbol].user_id)); } /** * The status set for the suspicious user. */ get lowTrustStatus() { return this[rawDataSymbol].low_trust_status; } /** * A list of channel IDs where the suspicious user is also banned. */ get sharedBanChannelIds() { return this[rawDataSymbol].shared_ban_channel_ids ?? []; } /** * User types (if any) that apply to the suspicious user. */ get types() { return this[rawDataSymbol].types; } /** * A ban evasion likelihood value (if any) that as been applied to the user automatically by Twitch. */ get banEvasionEvaluation() { return this[rawDataSymbol].ban_evasion_evaluation; } /** * The UUID that identifies the message. */ get messageId() { return this[rawDataSymbol].message.message_id; } /** * The chat message in plain text. */ get messageText() { return this[rawDataSymbol].message.text; } /** * Ordered list of chat message fragments. */ get messageParts() { return this[rawDataSymbol].message.fragments; } }; __decorate([ Enumerable(false) ], EventSubChannelSuspiciousUserMessageEvent.prototype, "_client", void 0); EventSubChannelSuspiciousUserMessageEvent = __decorate([ rtfm('eventsub-base', 'EventSubChannelSuspiciousUserMessageEvent', 'broadcasterId') ], EventSubChannelSuspiciousUserMessageEvent); export { EventSubChannelSuspiciousUserMessageEvent };