UNPKG

@twurple/eventsub-base

Version:

Base for the other Twurple EventSub packages

45 lines (44 loc) 1.84 kB
import { __decorate } from "tslib"; import { mapNullable } from '@d-fischer/shared-utils'; import { rawDataSymbol, rtfm } from '@twurple/common'; import { EventSubChannelChatBaseNotificationEvent } from './EventSubChannelChatBaseNotificationEvent.js'; /** * An EventSub event representing a notification of a user "paying it forward" in a channel's chat. */ let EventSubChannelChatPayItForwardNotificationEvent = class EventSubChannelChatPayItForwardNotificationEvent extends EventSubChannelChatBaseNotificationEvent { type = 'pay_it_forward'; /** * Whether the original gifter is anonymous. */ get isGifterAnonymous() { return this[rawDataSymbol].pay_it_forward.gifter_is_anonymous; } /** * The ID of the original gifter, or `null` if they're anonymous. */ get gifterId() { return this[rawDataSymbol].pay_it_forward.gifter_user_id; } /** * The username of the original gifter, or `null` if they're anonymous. */ get gifterName() { return this[rawDataSymbol].pay_it_forward.gifter_user_login; } /** * The display name of the original gifter, or `null` if they're anonymous. */ get gifterDisplayName() { return this[rawDataSymbol].pay_it_forward.gifter_user_name; } /** * Gets more information about the original gifter, or `null` if they're anonymous. */ async getGifter() { return await mapNullable(this[rawDataSymbol].pay_it_forward.gifter_user_id, async (id) => await this._client.users.getUserById(id)); } }; EventSubChannelChatPayItForwardNotificationEvent = __decorate([ rtfm('eventsub-base', 'EventSubChannelChatPayItForwardNotificationEvent', 'broadcasterId') ], EventSubChannelChatPayItForwardNotificationEvent); export { EventSubChannelChatPayItForwardNotificationEvent };