UNPKG

@twurple/eventsub-base

Version:

Base for the other Twurple EventSub packages

84 lines (83 loc) 2.77 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EventSubUserWhisperMessageEvent = 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 user receiving a whisper message from another user. */ let EventSubUserWhisperMessageEvent = class EventSubUserWhisperMessageEvent extends common_1.DataObject { /** @internal */ constructor(data, client) { super(data); this._client = client; } /** * The ID of the whisper message. */ get id() { return this[common_1.rawDataSymbol].whisper_id; } /** * The ID of the user received the whisper message. */ get userId() { return this[common_1.rawDataSymbol].to_user_id; } /** * The name of the user received the whisper message. */ get userName() { return this[common_1.rawDataSymbol].to_user_login; } /** * The display name of the user received the whisper message. */ get userDisplayName() { return this[common_1.rawDataSymbol].to_user_name; } /** * Gets more information about the user received the whisper message. */ async getUser() { return (0, common_1.checkRelationAssertion)(await this._client.users.getUserById(this[common_1.rawDataSymbol].to_user_id)); } /** * The ID of the user sent the whisper message. */ get senderUserId() { return this[common_1.rawDataSymbol].from_user_id; } /** * The name of the user sent the whisper message. */ get senderUserName() { return this[common_1.rawDataSymbol].from_user_login; } /** * The display name of the user sent the whisper message. */ get senderUserDisplayName() { return this[common_1.rawDataSymbol].from_user_name; } /** * Gets more information about the user sent the whisper message. */ async getSenderUser() { return (0, common_1.checkRelationAssertion)(await this._client.users.getUserById(this[common_1.rawDataSymbol].from_user_id)); } /** * The text of the whisper message. */ get messageText() { return this[common_1.rawDataSymbol].whisper.text; } }; exports.EventSubUserWhisperMessageEvent = EventSubUserWhisperMessageEvent; tslib_1.__decorate([ (0, shared_utils_1.Enumerable)(false) ], EventSubUserWhisperMessageEvent.prototype, "_client", void 0); exports.EventSubUserWhisperMessageEvent = EventSubUserWhisperMessageEvent = tslib_1.__decorate([ (0, common_1.rtfm)('eventsub-base', 'EventSubUserWhisperMessageEvent', 'id') ], EventSubUserWhisperMessageEvent);