mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-17 19:42:14 +00:00
* replaced YTNode's data arg as RawNode * updated documentation * removed unused import ---- Note that there are still many nodes that need to be updated, hence the WIP status.
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { YTNode } from '../../../helpers.js';
|
|
import Parser from '../../../index.js';
|
|
import Text from '../../misc/Text.js';
|
|
import Thumbnail from '../../misc/Thumbnail.js';
|
|
import type { RawNode } from '../../../index.js';
|
|
class LiveChatBannerPoll extends YTNode {
|
|
static type = 'LiveChatBannerPoll';
|
|
|
|
poll_question: Text;
|
|
author_photo: Thumbnail[];
|
|
choices: {
|
|
option_id: string;
|
|
text: string;
|
|
}[];
|
|
|
|
collapsed_state_entity_key: string;
|
|
live_chat_poll_state_entity_key: string;
|
|
context_menu_button;
|
|
|
|
constructor(data: RawNode) {
|
|
super();
|
|
this.poll_question = new Text(data.pollQuestion);
|
|
this.author_photo = Thumbnail.fromResponse(data.authorPhoto);
|
|
|
|
this.choices = data.pollChoices.map((choice: any) => ({
|
|
option_id: choice.pollOptionId,
|
|
text: new Text(choice.text).toString()
|
|
}));
|
|
|
|
this.collapsed_state_entity_key = data.collapsedStateEntityKey;
|
|
this.live_chat_poll_state_entity_key = data.liveChatPollStateEntityKey;
|
|
this.context_menu_button = Parser.parseItem(data.contextMenuButton);
|
|
}
|
|
}
|
|
|
|
export default LiveChatBannerPoll; |