UNPKG

@twurple/eventsub-base

Version:

Base for the other Twurple EventSub packages

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