mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-28 09:06:51 +00:00
refactor: migrate parsers to TS (#133)
* dev: finish top-level parsers TS migration
* dev: migrate menu renderers to TS
* chore: fix ts errors
* dev: finish ts migration 🎉
This commit is contained in:
42
src/parser/classes/livechat/items/LiveChatPaidSticker.ts
Normal file
42
src/parser/classes/livechat/items/LiveChatPaidSticker.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import Parser from '../../../index';
|
||||
import NavigationEndpoint from '../../NavigationEndpoint';
|
||||
import Thumbnail from '../../misc/Thumbnail';
|
||||
import Text from '../../misc/Text';
|
||||
import { YTNode } from '../../../helpers';
|
||||
|
||||
class LiveChatPaidSticker extends YTNode {
|
||||
static type = 'LiveChatPaidSticker';
|
||||
|
||||
id: string;
|
||||
|
||||
author: {
|
||||
id: string;
|
||||
name: Text;
|
||||
thumbnails: Thumbnail[];
|
||||
badges: any;
|
||||
};
|
||||
|
||||
sticker: Thumbnail[];
|
||||
purchase_amount: string;
|
||||
context_menu: NavigationEndpoint;
|
||||
timestamp: number;
|
||||
|
||||
constructor(data: any) {
|
||||
super();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
export default LiveChatPaidSticker;
|
||||
Reference in New Issue
Block a user