Send a predefined poll
(update: Update, context: ContextTypes.DEFAULT_TYPE)
| 100 | |
| 101 | |
| 102 | async def quiz(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: |
| 103 | """Send a predefined poll""" |
| 104 | questions = ["1", "2", "4", "20"] |
| 105 | message = await update.effective_message.reply_poll( |
| 106 | "How many eggs do you need for a cake?", questions, type=Poll.QUIZ, correct_option_id=2 |
| 107 | ) |
| 108 | # Save some info about the poll the bot_data for later use in receive_quiz_answer |
| 109 | payload = { |
| 110 | message.poll.id: {"chat_id": update.effective_chat.id, "message_id": message.message_id} |
| 111 | } |
| 112 | context.bot_data.update(payload) |
| 113 | |
| 114 | |
| 115 | async def receive_quiz_answer(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…