MCPcopy Index your code
hub / github.com/python-telegram-bot/python-telegram-bot / receive_quiz_answer

Function receive_quiz_answer

examples/pollbot.py:115–126  ·  view source on GitHub ↗

Close quiz after three participants took it

(update: Update, context: ContextTypes.DEFAULT_TYPE)

Source from the content-addressed store, hash-verified

113
114
115async def receive_quiz_answer(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
116 """Close quiz after three participants took it"""
117 # the bot can receive closed poll updates we don't care about
118 if update.poll.is_closed:
119 return
120 if update.poll.total_voter_count == TOTAL_VOTER_COUNT:
121 try:
122 quiz_data = context.bot_data[update.poll.id]
123 # this means this poll answer update is from an old poll, we can't stop it then
124 except KeyError:
125 return
126 await context.bot.stop_poll(quiz_data["chat_id"], quiz_data["message_id"])
127
128
129async def preview(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:

Callers

nothing calls this directly

Calls 1

stop_pollMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…