@twurple/eventsub-base
Version:
Base for the other Twurple EventSub packages
46 lines (45 loc) • 2.07 kB
JavaScript
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 upgrading their gifted sub to a paid one in another channel's
* chat during a shared chat session.
*/
let EventSubChannelChatSharedChatGiftPaidUpgradeNotificationEvent = class EventSubChannelChatSharedChatGiftPaidUpgradeNotificationEvent extends EventSubChannelChatBaseNotificationEvent {
type = 'shared_chat_gift_paid_upgrade';
/**
* Whether the original gifter is anonymous.
*/
get isGifterAnonymous() {
return this[rawDataSymbol].shared_chat_gift_paid_upgrade.gifter_is_anonymous;
}
/**
* The ID of the original gifter, or `null` if they're anonymous.
*/
get gifterId() {
return this[rawDataSymbol].shared_chat_gift_paid_upgrade.gifter_user_id;
}
/**
* The username of the original gifter, or `null` if they're anonymous.
*/
get gifterName() {
return this[rawDataSymbol].shared_chat_gift_paid_upgrade.gifter_user_login;
}
/**
* The display name of the original gifter, or `null` if they're anonymous.
*/
get gifterDisplayName() {
return this[rawDataSymbol].shared_chat_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].shared_chat_gift_paid_upgrade.gifter_user_id, async (id) => await this._client.users.getUserById(id));
}
};
EventSubChannelChatSharedChatGiftPaidUpgradeNotificationEvent = __decorate([
rtfm('eventsub-base', 'EventSubChannelChatSharedChatGiftPaidUpgradeNotificationEvent', 'broadcasterId')
], EventSubChannelChatSharedChatGiftPaidUpgradeNotificationEvent);
export { EventSubChannelChatSharedChatGiftPaidUpgradeNotificationEvent };