UNPKG

@twurple/eventsub-base

Version:

Base for the other Twurple EventSub packages

68 lines (67 loc) 2.57 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EventSubChannelChatSubGiftNotificationEvent = void 0; const tslib_1 = require("tslib"); const common_1 = require("@twurple/common"); const EventSubChannelChatBaseNotificationEvent_1 = require("./EventSubChannelChatBaseNotificationEvent"); /** * An EventSub event representing a sub gift notification in a channel's chat. */ let EventSubChannelChatSubGiftNotificationEvent = class EventSubChannelChatSubGiftNotificationEvent extends EventSubChannelChatBaseNotificationEvent_1.EventSubChannelChatBaseNotificationEvent { constructor() { super(...arguments); this.type = 'sub_gift'; } /** * The tier of the subscription. */ get tier() { return this[common_1.rawDataSymbol].sub_gift.sub_tier; } /** * The number of months the subscription is for. */ get durationMonths() { return this[common_1.rawDataSymbol].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[common_1.rawDataSymbol].sub_gift.cumulative_total; } /** * The ID of the recipient. */ get recipientId() { return this[common_1.rawDataSymbol].sub_gift.recipient_user_id; } /** * The username of the recipient. */ get recipientName() { return this[common_1.rawDataSymbol].sub_gift.recipient_user_login; } /** * The display name of the recipient. */ get recipientDisplayName() { return this[common_1.rawDataSymbol].sub_gift.recipient_user_name; } /** * Gets more information about the recipient. */ async getRecipient() { return (0, common_1.checkRelationAssertion)(await this._client.users.getUserById(this[common_1.rawDataSymbol].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[common_1.rawDataSymbol].sub_gift.community_gift_id; } }; exports.EventSubChannelChatSubGiftNotificationEvent = EventSubChannelChatSubGiftNotificationEvent; exports.EventSubChannelChatSubGiftNotificationEvent = EventSubChannelChatSubGiftNotificationEvent = tslib_1.__decorate([ (0, common_1.rtfm)('eventsub-base', 'EventSubChannelChatSubGiftNotificationEvent', 'broadcasterId') ], EventSubChannelChatSubGiftNotificationEvent);