@twurple/eventsub-base
Version:
Base for the other Twurple EventSub packages
115 lines (114 loc) • 3.88 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventSubChannelSuspiciousUserMessageEvent = void 0;
const tslib_1 = require("tslib");
const shared_utils_1 = require("@d-fischer/shared-utils");
const common_1 = require("@twurple/common");
/**
* An EventSub event representing a message sent by a suspicious user in a channel.
*/
let EventSubChannelSuspiciousUserMessageEvent = class EventSubChannelSuspiciousUserMessageEvent extends common_1.DataObject {
/** @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[common_1.rawDataSymbol].broadcaster_user_id;
}
/**
* The name of the channel in which a suspicious user sent the message.
*/
get broadcasterName() {
return this[common_1.rawDataSymbol].broadcaster_user_login;
}
/**
* The display name of the channel in which a suspicious user sent the message.
*/
get broadcasterDisplayName() {
return this[common_1.rawDataSymbol].broadcaster_user_name;
}
/**
* Gets more information about the broadcaster.
*/
async getBroadcaster() {
return (0, common_1.checkRelationAssertion)(await this._client.users.getUserById(this[common_1.rawDataSymbol].broadcaster_user_id));
}
/**
* The ID of the user who sent the message.
*/
get userId() {
return this[common_1.rawDataSymbol].user_id;
}
/**
* The name of the user who sent the message.
*/
get userName() {
return this[common_1.rawDataSymbol].user_login;
}
/**
* The display name of the user who sent the message.
*/
get userDisplayName() {
return this[common_1.rawDataSymbol].user_name;
}
/**
* Gets more information about the user whose treatment was updated.
*/
async getUser() {
return (0, common_1.checkRelationAssertion)(await this._client.users.getUserById(this[common_1.rawDataSymbol].user_id));
}
/**
* The status set for the suspicious user.
*/
get lowTrustStatus() {
return this[common_1.rawDataSymbol].low_trust_status;
}
/**
* A list of channel IDs where the suspicious user is also banned.
*/
get sharedBanChannelIds() {
var _a;
return (_a = this[common_1.rawDataSymbol].shared_ban_channel_ids) !== null && _a !== void 0 ? _a : [];
}
/**
* User types (if any) that apply to the suspicious user.
*/
get types() {
return this[common_1.rawDataSymbol].types;
}
/**
* A ban evasion likelihood value (if any) that as been applied to the user automatically by Twitch.
*/
get banEvasionEvaluation() {
return this[common_1.rawDataSymbol].ban_evasion_evaluation;
}
/**
* The UUID that identifies the message.
*/
get messageId() {
return this[common_1.rawDataSymbol].message.message_id;
}
/**
* The chat message in plain text.
*/
get messageText() {
return this[common_1.rawDataSymbol].message.text;
}
/**
* Ordered list of chat message fragments.
*/
get messageParts() {
return this[common_1.rawDataSymbol].message.fragments;
}
};
exports.EventSubChannelSuspiciousUserMessageEvent = EventSubChannelSuspiciousUserMessageEvent;
tslib_1.__decorate([
(0, shared_utils_1.Enumerable)(false)
], EventSubChannelSuspiciousUserMessageEvent.prototype, "_client", void 0);
exports.EventSubChannelSuspiciousUserMessageEvent = EventSubChannelSuspiciousUserMessageEvent = tslib_1.__decorate([
(0, common_1.rtfm)('eventsub-base', 'EventSubChannelSuspiciousUserMessageEvent', 'broadcasterId')
], EventSubChannelSuspiciousUserMessageEvent);