2023-01-28 16:20:58 +03:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
2023-02-04 08:27:29 +03:00
|
|
|
# This is an example file to create quiz polls
|
2023-01-28 16:20:58 +03:00
|
|
|
import telebot
|
|
|
|
|
|
|
|
API_TOKEN = "<api_token>"
|
|
|
|
|
|
|
|
bot = telebot.TeleBot(API_TOKEN)
|
|
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(commands=["poll"])
|
|
|
|
def create_poll(message):
|
|
|
|
bot.send_message(message.chat.id, "English Article Test")
|
|
|
|
answer_options = ["a", "an", "the", "-"]
|
|
|
|
|
2023-02-04 08:27:29 +03:00
|
|
|
bot.send_poll(
|
2023-01-28 16:20:58 +03:00
|
|
|
chat_id=message.chat.id,
|
|
|
|
question="We are going to '' park.",
|
|
|
|
options=answer_options,
|
2023-02-04 09:22:49 +03:00
|
|
|
type="quiz",
|
2023-02-04 08:27:29 +03:00
|
|
|
correct_option_id=2,
|
2023-01-28 16:20:58 +03:00
|
|
|
is_anonymous=False,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-02-04 09:22:49 +03:00
|
|
|
@bot.poll_answer_handler()
|
|
|
|
def handle_poll(poll):
|
|
|
|
# This handler can be used to log User answers and to send next poll
|
|
|
|
pass
|
|
|
|
|
2023-01-28 16:20:58 +03:00
|
|
|
|
|
|
|
bot.infinity_polling()
|