Files
YouTube.js/src/parser/classes/livechat/items/LiveChatTickerPaidMessageItem.ts
Daniel Wykerd b13bf6e992 refactor(Parser)!: general refactoring of parsers (#344)
* refactor: move common info into MediaInfo

* refactor: better inference on Memo

* refactor: improved typesafety in parser methods

* refactor: remove PlaylistAuthor in favor of Author

* refactor: cleanup live chat parsers

- Replace non standard author type with Author class
- Remove redundant code

* fix: new errors due to changes

* fix: pass actions to FormatUtils#toDash

* refactor!: merge NavigatableText and Text into single class
2023-03-15 18:25:12 -03:00

35 lines
1.1 KiB
TypeScript

import Parser from '../../../index.js';
import Text from '../../misc/Text.js';
import NavigationEndpoint from '../../NavigationEndpoint.js';
import type { RawNode } from '../../../index.js';
import { YTNode } from '../../../helpers.js';
import Author from '../../misc/Author.js';
class LiveChatTickerPaidMessageItem extends YTNode {
static type = 'LiveChatTickerPaidMessageItem';
author: Author;
amount: Text;
duration_sec: string; // Or number?
full_duration_sec: string;
show_item;
show_item_endpoint: NavigationEndpoint;
id: string;
constructor(data: RawNode) {
super();
this.author = new Author(data.authorName, data.authorBadges, data.authorPhoto, data.authorExternalChannelId);
this.amount = new Text(data.amount);
this.duration_sec = data.durationSec;
this.full_duration_sec = data.fullDurationSec;
this.show_item = Parser.parseItem(data.showItemEndpoint?.showLiveChatItemEndpoint?.renderer);
this.show_item_endpoint = new NavigationEndpoint(data.showItemEndpoint);
this.id = data.id;
}
}
export default LiveChatTickerPaidMessageItem;