@twurple/eventsub-base
Version:
Base for the other Twurple EventSub packages
48 lines (47 loc) • 1.97 kB
JavaScript
import { __decorate } from "tslib";
import { mapNullable } from '@d-fischer/shared-utils';
import { rawDataSymbol, rtfm } from '@twurple/common';
import { EventSubChannelChatBaseNotificationEvent } from "./EventSubChannelChatBaseNotificationEvent.mjs";
/**
* An EventSub event representing a notification of a user upgrading their gifted sub to a paid one in a channel's chat.
*/
let EventSubChannelChatGiftPaidUpgradeNotificationEvent = class EventSubChannelChatGiftPaidUpgradeNotificationEvent extends EventSubChannelChatBaseNotificationEvent {
constructor() {
super(...arguments);
this.type = 'gift_paid_upgrade';
}
/**
* Whether the original gifter is anonymous.
*/
get isGifterAnonymous() {
return this[rawDataSymbol].gift_paid_upgrade.gifter_is_anonymous;
}
/**
* The ID of the original gifter, or `null` if they're anonymous.
*/
get gifterId() {
return this[rawDataSymbol].gift_paid_upgrade.gifter_user_id;
}
/**
* The username of the original gifter, or `null` if they're anonymous.
*/
get gifterName() {
return this[rawDataSymbol].gift_paid_upgrade.gifter_user_login;
}
/**
* The display name of the original gifter, or `null` if they're anonymous.
*/
get gifterDisplayName() {
return this[rawDataSymbol].gift_paid_upgrade.gifter_user_name;
}
/**
* Gets more information about the original gifter, or `null` if they're anonymous.
*/
async getGifter() {
return await mapNullable(this[rawDataSymbol].gift_paid_upgrade.gifter_user_id, async (id) => await this._client.users.getUserById(id));
}
};
EventSubChannelChatGiftPaidUpgradeNotificationEvent = __decorate([
rtfm('eventsub-base', 'EventSubChannelChatGiftPaidUpgradeNotificationEvent', 'broadcasterId')
], EventSubChannelChatGiftPaidUpgradeNotificationEvent);
export { EventSubChannelChatGiftPaidUpgradeNotificationEvent };