@twurple/eventsub-base
Version:
Base for the other Twurple EventSub packages
51 lines (50 loc) • 2.35 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventSubChannelChatGiftPaidUpgradeNotificationEvent = 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 upgrading their gifted sub to a paid one in a channel's chat.
*/
let EventSubChannelChatGiftPaidUpgradeNotificationEvent = class EventSubChannelChatGiftPaidUpgradeNotificationEvent extends EventSubChannelChatBaseNotificationEvent_1.EventSubChannelChatBaseNotificationEvent {
constructor() {
super(...arguments);
this.type = 'gift_paid_upgrade';
}
/**
* Whether the original gifter is anonymous.
*/
get isGifterAnonymous() {
return this[common_1.rawDataSymbol].gift_paid_upgrade.gifter_is_anonymous;
}
/**
* The ID of the original gifter, or `null` if they're anonymous.
*/
get gifterId() {
return this[common_1.rawDataSymbol].gift_paid_upgrade.gifter_user_id;
}
/**
* The username of the original gifter, or `null` if they're anonymous.
*/
get gifterName() {
return this[common_1.rawDataSymbol].gift_paid_upgrade.gifter_user_login;
}
/**
* The display name of the original gifter, or `null` if they're anonymous.
*/
get gifterDisplayName() {
return this[common_1.rawDataSymbol].gift_paid_upgrade.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].gift_paid_upgrade.gifter_user_id, async (id) => await this._client.users.getUserById(id));
}
};
exports.EventSubChannelChatGiftPaidUpgradeNotificationEvent = EventSubChannelChatGiftPaidUpgradeNotificationEvent;
exports.EventSubChannelChatGiftPaidUpgradeNotificationEvent = EventSubChannelChatGiftPaidUpgradeNotificationEvent = tslib_1.__decorate([
(0, common_1.rtfm)('eventsub-base', 'EventSubChannelChatGiftPaidUpgradeNotificationEvent', 'broadcasterId')
], EventSubChannelChatGiftPaidUpgradeNotificationEvent);