UNPKG

@twurple/eventsub-base

Version:

Base for the other Twurple EventSub packages

51 lines (50 loc) 2.28 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EventSubChannelChatPayItForwardNotificationEvent = void 0; const tslib_1 = require("tslib"); const shared_utils_1 = require("@d-fischer/shared-utils"); const common_1 = require("@twurple/common"); const EventSubChannelChatBaseNotificationEvent_1 = require("./EventSubChannelChatBaseNotificationEvent"); /** * An EventSub event representing a notification of a user "paying it forward" in a channel's chat. */ let EventSubChannelChatPayItForwardNotificationEvent = class EventSubChannelChatPayItForwardNotificationEvent extends EventSubChannelChatBaseNotificationEvent_1.EventSubChannelChatBaseNotificationEvent { constructor() { super(...arguments); this.type = 'pay_it_forward'; } /** * Whether the original gifter is anonymous. */ get isGifterAnonymous() { return this[common_1.rawDataSymbol].pay_it_forward.gifter_is_anonymous; } /** * The ID of the original gifter, or `null` if they're anonymous. */ get gifterId() { return this[common_1.rawDataSymbol].pay_it_forward.gifter_user_id; } /** * The username of the original gifter, or `null` if they're anonymous. */ get gifterName() { return this[common_1.rawDataSymbol].pay_it_forward.gifter_user_login; } /** * The display name of the original gifter, or `null` if they're anonymous. */ get gifterDisplayName() { return this[common_1.rawDataSymbol].pay_it_forward.gifter_user_name; } /** * Gets more information about the original gifter, or `null` if they're anonymous. */ async getGifter() { return await (0, shared_utils_1.mapNullable)(this[common_1.rawDataSymbol].pay_it_forward.gifter_user_id, async (id) => await this._client.users.getUserById(id)); } }; exports.EventSubChannelChatPayItForwardNotificationEvent = EventSubChannelChatPayItForwardNotificationEvent; exports.EventSubChannelChatPayItForwardNotificationEvent = EventSubChannelChatPayItForwardNotificationEvent = tslib_1.__decorate([ (0, common_1.rtfm)('eventsub-base', 'EventSubChannelChatPayItForwardNotificationEvent', 'broadcasterId') ], EventSubChannelChatPayItForwardNotificationEvent);