UNPKG

@twurple/eventsub-base

Version:

Base for the other Twurple EventSub packages

62 lines (61 loc) 2.35 kB
import { __decorate } from "tslib"; import { checkRelationAssertion, rawDataSymbol, rtfm } from '@twurple/common'; import { EventSubChannelChatBaseNotificationEvent } from './EventSubChannelChatBaseNotificationEvent.js'; /** * An EventSub event representing a sub gift notification in another channel's chat during a shared chat session. */ let EventSubChannelChatSharedChatSubGiftNotificationEvent = class EventSubChannelChatSharedChatSubGiftNotificationEvent extends EventSubChannelChatBaseNotificationEvent { type = 'shared_chat_sub_gift'; /** * The tier of the subscription. */ get tier() { return this[rawDataSymbol].shared_chat_sub_gift.sub_tier; } /** * The number of months the subscription is for. */ get durationMonths() { return this[rawDataSymbol].shared_chat_sub_gift.duration_months || 1; } /** * The amount of gifts that the gifter has sent in total, or `null` the gift is anonymous. */ get cumulativeAmount() { return this[rawDataSymbol].shared_chat_sub_gift.cumulative_total; } /** * The ID of the recipient. */ get recipientId() { return this[rawDataSymbol].shared_chat_sub_gift.recipient_user_id; } /** * The username of the recipient. */ get recipientName() { return this[rawDataSymbol].shared_chat_sub_gift.recipient_user_login; } /** * The display name of the recipient. */ get recipientDisplayName() { return this[rawDataSymbol].shared_chat_sub_gift.recipient_user_name; } /** * Gets more information about the recipient. */ async getRecipient() { return checkRelationAssertion(await this._client.users.getUserById(this[rawDataSymbol].shared_chat_sub_gift.recipient_user_id)); } /** * The id of the community gift the sub gift belongs to, or `null` if it doesn't belong to any community gift. */ get communityGiftId() { return this[rawDataSymbol].shared_chat_sub_gift.community_gift_id; } }; EventSubChannelChatSharedChatSubGiftNotificationEvent = __decorate([ rtfm('eventsub-base', 'EventSubChannelChatSharedChatSubGiftNotificationEvent', 'broadcasterId') ], EventSubChannelChatSharedChatSubGiftNotificationEvent); export { EventSubChannelChatSharedChatSubGiftNotificationEvent };