From 263b4887c3d6eba615dc315d54cb057abf9ce344 Mon Sep 17 00:00:00 2001 From: LuanRT Date: Wed, 29 Jun 2022 19:44:33 -0300 Subject: [PATCH] feat(livechat): add LiveChatPaidSticker action --- .../livechat/items/LiveChatPaidSticker.js | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 lib/parser/contents/classes/livechat/items/LiveChatPaidSticker.js diff --git a/lib/parser/contents/classes/livechat/items/LiveChatPaidSticker.js b/lib/parser/contents/classes/livechat/items/LiveChatPaidSticker.js new file mode 100644 index 00000000..0e781c4f --- /dev/null +++ b/lib/parser/contents/classes/livechat/items/LiveChatPaidSticker.js @@ -0,0 +1,28 @@ +'use strict'; + +const Parser = require('../../..'); +const NavigationEndpoint = require('../../NavigationEndpoint'); +const Thumbnail = require('../../Thumbnail'); +const Text = require('../../Text'); + +class LiveChatPaidSticker { + type = 'LiveChatPaidSticker'; + + constructor(data) { + this.id = data.id; + + this.author = { + id: data.authorExternalChannelId, + name: new Text(data.authorName), + thumbnails: Thumbnail.fromResponse(data.authorPhoto), + badges: Parser.parse(data.authorBadges) + }; + + this.sticker = Thumbnail.fromResponse(data.sticker); + this.purchase_amount = new Text(data.purchaseAmountText).toString(); + this.context_menu = new NavigationEndpoint(data.contextMenuEndpoint); + this.timestamp = Math.floor(parseInt(data.timestampUsec) / 1000); + } +} + +module.exports = LiveChatPaidSticker;