From a8322e35f554e2b9a7f18415f837a6a432e8e2d4 Mon Sep 17 00:00:00 2001 From: Akazawa Daisuke <40195276+akkadaska@users.noreply.github.com> Date: Sun, 4 Sep 2022 17:57:41 +0900 Subject: [PATCH] feat: Add paid chat color info (#164) --- src/parser/classes/livechat/items/LiveChatPaidMessage.ts | 8 ++++++++ src/parser/classes/livechat/items/LiveChatPaidSticker.ts | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/parser/classes/livechat/items/LiveChatPaidMessage.ts b/src/parser/classes/livechat/items/LiveChatPaidMessage.ts index 0511dd0c..b2cb0426 100644 --- a/src/parser/classes/livechat/items/LiveChatPaidMessage.ts +++ b/src/parser/classes/livechat/items/LiveChatPaidMessage.ts @@ -20,6 +20,10 @@ class LiveChatPaidMessage extends YTNode { is_verified_artist: boolean | null; }; + header_background_color: number; + header_text_color: number; + body_background_color: number; + body_text_color: number; purchase_amount: string; menu_endpoint: NavigationEndpoint; timestamp: number; @@ -47,6 +51,10 @@ class LiveChatPaidMessage extends YTNode { this.author.is_verified = badges?.some((badge: any) => badge.style == 'BADGE_STYLE_TYPE_VERIFIED') || null; this.author.is_verified_artist = badges?.some((badge: any) => badge.style == 'BADGE_STYLE_TYPE_VERIFIED_ARTIST') || null; + this.header_background_color = data.headerBackgroundColor; + this.header_text_color = data.headerTextColor; + this.body_background_color = data.bodyBackgroundColor; + this.body_text_color = data.bodyTextColor; this.purchase_amount = new Text(data.purchaseAmountText).toString(); this.menu_endpoint = new NavigationEndpoint(data.contextMenuEndpoint); this.timestamp = Math.floor(parseInt(data.timestampUsec) / 1000); diff --git a/src/parser/classes/livechat/items/LiveChatPaidSticker.ts b/src/parser/classes/livechat/items/LiveChatPaidSticker.ts index 5097f855..e73da05e 100644 --- a/src/parser/classes/livechat/items/LiveChatPaidSticker.ts +++ b/src/parser/classes/livechat/items/LiveChatPaidSticker.ts @@ -16,6 +16,10 @@ class LiveChatPaidSticker extends YTNode { badges: any; }; + money_chip_background_color: number; + money_chip_text_color: number; + background_color: number; + author_name_text_color: number; sticker: Thumbnail[]; purchase_amount: string; context_menu: NavigationEndpoint; @@ -32,6 +36,10 @@ class LiveChatPaidSticker extends YTNode { badges: Parser.parse(data.authorBadges) }; + this.money_chip_background_color = data.moneyChipBackgroundColor; + this.money_chip_text_color = data.moneyChipTextColor; + this.background_color = data.backgroundColor; + this.author_name_text_color = data.authorNameTextColor; this.sticker = Thumbnail.fromResponse(data.sticker); this.purchase_amount = new Text(data.purchaseAmountText).toString(); this.context_menu = new NavigationEndpoint(data.contextMenuEndpoint);