From 20f797129973c6b91fa228e50d375b0c9d0226d2 Mon Sep 17 00:00:00 2001 From: jonz94 Date: Sat, 9 Nov 2024 23:22:46 +0800 Subject: [PATCH] feat(parser): Add `LiveChatSponsorshipsGiftRedemptionAnnouncement` node (#795) --- ...tSponsorshipsGiftRedemptionAnnouncement.ts | 35 +++++++++++++++++++ src/parser/nodes.ts | 1 + 2 files changed, 36 insertions(+) create mode 100644 src/parser/classes/livechat/items/LiveChatSponsorshipsGiftRedemptionAnnouncement.ts diff --git a/src/parser/classes/livechat/items/LiveChatSponsorshipsGiftRedemptionAnnouncement.ts b/src/parser/classes/livechat/items/LiveChatSponsorshipsGiftRedemptionAnnouncement.ts new file mode 100644 index 000000000..f0a77e87f --- /dev/null +++ b/src/parser/classes/livechat/items/LiveChatSponsorshipsGiftRedemptionAnnouncement.ts @@ -0,0 +1,35 @@ +import { YTNode } from '../../../helpers.js'; +import type { RawNode } from '../../../index.js'; +import NavigationEndpoint from '../../NavigationEndpoint.js'; +import Author from '../../misc/Author.js'; +import Text from '../../misc/Text.js'; + +export default class LiveChatSponsorshipsGiftRedemptionAnnouncement extends YTNode { + static type = 'LiveChatSponsorshipsGiftRedemptionAnnouncement'; + + id: string; + timestamp_usec: string; + timestamp_text: Text; + author: Author; + message: Text; + menu_endpoint: NavigationEndpoint; + context_menu_accessibility_label: string; + + constructor(data: RawNode) { + super(); + this.id = data.id; + this.timestamp_usec = data.timestampUsec; + this.timestamp_text = new Text(data.timestampText); + + this.author = new Author( + data.authorName, + data.authorBadges, + data.authorPhoto, + data.authorExternalChannelId + ); + + this.message = new Text(data.message); + this.menu_endpoint = new NavigationEndpoint(data.contextMenuEndpoint); + this.context_menu_accessibility_label = data.contextMenuAccessibility.accessibilityData.label; + } +} \ No newline at end of file diff --git a/src/parser/nodes.ts b/src/parser/nodes.ts index f254c5558..fe5f344c3 100644 --- a/src/parser/nodes.ts +++ b/src/parser/nodes.ts @@ -188,6 +188,7 @@ export { default as LiveChatPlaceholderItem } from './classes/livechat/items/Liv export { default as LiveChatProductItem } from './classes/livechat/items/LiveChatProductItem.js'; export { default as LiveChatRestrictedParticipation } from './classes/livechat/items/LiveChatRestrictedParticipation.js'; export { default as LiveChatSponsorshipsGiftPurchaseAnnouncement } from './classes/livechat/items/LiveChatSponsorshipsGiftPurchaseAnnouncement.js'; +export { default as LiveChatSponsorshipsGiftRedemptionAnnouncement } from './classes/livechat/items/LiveChatSponsorshipsGiftRedemptionAnnouncement.js'; export { default as LiveChatSponsorshipsHeader } from './classes/livechat/items/LiveChatSponsorshipsHeader.js'; export { default as LiveChatTextMessage } from './classes/livechat/items/LiveChatTextMessage.js'; export { default as LiveChatTickerPaidMessageItem } from './classes/livechat/items/LiveChatTickerPaidMessageItem.js';