Ejemplo n.º 1
0
def next_word(updater: Updater, context: CallbackContext, user: User):
    query = updater.callback_query
    word_id = query.data.split()[1]
    word = Word.get_or_none(id=word_id)

    if not word:
        query.answer(text="word not found")
        return

    word.go_next_level()
    user.answered()
    query.answer(text="success")

    query.edit_message_caption(updater.effective_message.caption_markdown +
                               ' ✅',
                               parse_mode="Markdown")
Ejemplo n.º 2
0
def back_word(updater: Updater, context: CallbackContext, user: User):
    query = updater.callback_query
    word_id = query.data.split()[1]
    word = Word.get_or_none(id=word_id)

    if not word:
        query.answer(text="word not found")
        return

    word.back_to_first_level()
    user.answered()
    query.answer(text="success")

    query.edit_message_caption(caption="Read the definition again. 💪\n\n" +
                               get_def_markdown(word.value),
                               parse_mode="Markdown")