diff --git a/src/parser/classes/livechat/items/LiveChatSponsorshipsGiftPurchaseAnnouncement.ts b/src/parser/classes/livechat/items/LiveChatSponsorshipsGiftPurchaseAnnouncement.ts new file mode 100644 index 000000000..39f51f90a --- /dev/null +++ b/src/parser/classes/livechat/items/LiveChatSponsorshipsGiftPurchaseAnnouncement.ts @@ -0,0 +1,20 @@ +import { YTNode } from '../../../helpers.js'; +import { Parser, type RawNode } from '../../../index.js'; +import LiveChatSponsorshipsHeader from './LiveChatSponsorshipsHeader.js'; + +export default class LiveChatSponsorshipsGiftPurchaseAnnouncement extends YTNode { + static type = 'LiveChatSponsorshipsGiftPurchaseAnnouncement'; + + id: string; + timestamp_usec: string; + author_external_channel_id: string; + header: LiveChatSponsorshipsHeader | null; + + constructor(data: RawNode) { + super(); + this.id = data.id; + this.timestamp_usec = data.timestampUsec; + this.author_external_channel_id = data.authorExternalChannelId; + this.header = Parser.parseItem(data.header, LiveChatSponsorshipsHeader); + } +} \ No newline at end of file diff --git a/src/parser/classes/livechat/items/LiveChatSponsorshipsHeader.ts b/src/parser/classes/livechat/items/LiveChatSponsorshipsHeader.ts new file mode 100644 index 000000000..7c1873573 --- /dev/null +++ b/src/parser/classes/livechat/items/LiveChatSponsorshipsHeader.ts @@ -0,0 +1,31 @@ +import { Parser } from '../../../index.js'; +import { YTNode } from '../../../helpers.js'; +import type { ObservedArray } from '../../../helpers.js'; +import type { RawNode } from '../../../index.js'; +import NavigationEndpoint from '../../NavigationEndpoint.js'; +import Text from '../../misc/Text.js'; +import Thumbnail from '../../misc/Thumbnail.js'; +import LiveChatAuthorBadge from '../../LiveChatAuthorBadge.js'; + +export default class LiveChatSponsorshipsHeader extends YTNode { + static type = 'LiveChatSponsorshipsHeader'; + + author_name: Text; + author_photo: Thumbnail[]; + author_badges: ObservedArray | null; + primary_text: Text; + menu_endpoint: NavigationEndpoint; + context_menu_accessibility_label: string; + image: Thumbnail[]; + + constructor(data: RawNode) { + super(); + this.author_name = new Text(data.authorName); + this.author_photo = Thumbnail.fromResponse(data.authorPhoto); + this.author_badges = Parser.parseArray(data.authorBadges, LiveChatAuthorBadge); + this.primary_text = new Text(data.primaryText); + this.menu_endpoint = new NavigationEndpoint(data.contextMenuEndpoint); + this.context_menu_accessibility_label = data.contextMenuAccessibility.accessibilityData.label; + this.image = Thumbnail.fromResponse(data.image); + } +} \ No newline at end of file diff --git a/src/parser/nodes.ts b/src/parser/nodes.ts index a6dc9d53e..f254c5558 100644 --- a/src/parser/nodes.ts +++ b/src/parser/nodes.ts @@ -187,6 +187,8 @@ export { default as LiveChatPaidSticker } from './classes/livechat/items/LiveCha export { default as LiveChatPlaceholderItem } from './classes/livechat/items/LiveChatPlaceholderItem.js'; 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 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'; export { default as LiveChatTickerPaidStickerItem } from './classes/livechat/items/LiveChatTickerPaidStickerItem.js';