From 2b706f511e5cff2b18a5f23ebc54cfdf7c79828d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20Rold=C3=A1n=20Piju=C3=A1n?= Date: Sat, 23 Apr 2022 10:25:09 +0200 Subject: [PATCH] Pasar a siguiente pregunta si acertamos --- bot.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bot.py b/bot.py index 81a9469..290d7d2 100644 --- a/bot.py +++ b/bot.py @@ -123,6 +123,16 @@ def select_option_callback_handler(call): question = find_question(test, q) answer_reply = check_answer(question, answer) bot.answer_callback_query(call.id, answer_reply) + if answer_reply: + question = find_question(test, eval(q+'+1')) + keyboard = generate_test_keyboard(question, test) + txt = "Test: {}\nPregunta: {}\n\n{}" + try: + bot.edit_message_media(types.InputMediaPhoto(question.get('img'), caption=txt.format(test, question['pregunta'], question['encabezado'])), cid, mid, reply_markup=keyboard) + bot.answer_callback_query(call.id) + except: + bot.answer_callback_query(call.id, "No se pudo cargar la pregunta") + @bot.callback_query_handler(func=lambda call: call.data.startswith('pregunta') and (call.data.endswith('+') or call.data.endswith('-'))) def question_pager_callback_handler(call):