Pasar a siguiente pregunta si acertamos
This commit is contained in:
10
bot.py
10
bot.py
@ -123,6 +123,16 @@ def select_option_callback_handler(call):
|
|||||||
question = find_question(test, q)
|
question = find_question(test, q)
|
||||||
answer_reply = check_answer(question, answer)
|
answer_reply = check_answer(question, answer)
|
||||||
bot.answer_callback_query(call.id, answer_reply)
|
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('-')))
|
@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):
|
def question_pager_callback_handler(call):
|
||||||
|
|||||||
Reference in New Issue
Block a user