Skip to main content

Quiz

Poll is an object which ask user to choose an correct option.

import { Quiz } from "@tlgr/quiz";
const quiz = new Quiz(bot, options);

bot.start(ctx => {
await quiz.send(ctx);
})

// some time after
await quiz.stop();

Events described at events page

extends​

constructor(bot, options)​

added in 1.0.0
  • bot - <Object>. Telegraf instance.
  • options - <Object>. Quiz options
    • name - <string>. Quiz name.
    • options - <string[]>. possible options as an array.
    • open_period - <number>. Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date.
    • is_anonymous - <boolean>. True, if the poll needs to be anonymous, defaults to True.
    • correct_option_id - <number>. Correct answer id where 0 - the first of options.