Skip to content

Commit

Permalink
feat(parser): Add Quiz (#437)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChunkyProgrammer authored Jul 14, 2023
1 parent f267fcd commit cffa868
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/parser/classes/Quiz.ts
Original file line number Diff line number Diff line change
@@ -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);
}
}
1 change: 1 addition & 0 deletions src/parser/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ export { default as ProfileColumn } from './classes/ProfileColumn.js';
export { default as ProfileColumnStats } from './classes/ProfileColumnStats.js';
export { default as ProfileColumnStatsEntry } from './classes/ProfileColumnStatsEntry.js';
export { default as ProfileColumnUserInfo } from './classes/ProfileColumnUserInfo.js';
export { default as Quiz } from './classes/Quiz.js';
export { default as RecognitionShelf } from './classes/RecognitionShelf.js';
export { default as ReelItem } from './classes/ReelItem.js';
export { default as ReelShelf } from './classes/ReelShelf.js';
Expand Down

0 comments on commit cffa868

Please sign in to comment.