feat(parser): Add Quiz (#437)

This commit is contained in:
ChunkyProgrammer
2023-07-13 19:57:39 -07:00
committed by GitHub
parent f267fcd8be
commit cffa868c6e
2 changed files with 26 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
import { YTNode } from '../helpers.js';
import type { RawNode } from '../index.js';
import Text from './misc/Text.js';
export default class Quiz extends YTNode {
static type = 'Quiz';
choices: {
text: Text;
is_correct: boolean;
}[];
total_votes: Text;
constructor(data: RawNode) {
super();
this.choices = data.choices.map((choice: RawNode) => ({
text: new Text(choice.text),
is_correct: choice.isCorrect
}));
this.total_votes = new Text(data.totalVotes);
}
}