Skip to content

Commit

Permalink
next page bug
Browse files Browse the repository at this point in the history
  • Loading branch information
hawk-roman-rey committed May 22, 2022
1 parent 13db43d commit 909eab1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions daily_word_bot/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,17 +209,16 @@ def callback_on_get_blockwords_callback(self, update: Update, context: CallbackC

inline_keyboard_buttons = []

show_pagination = n_words >= WORDS_PER_PAGE

for blocked_word in blocked_words:
word_id = blocked_word["word_id"]
german_word = blocked_word["de"]
spanish_word = blocked_word["es"]
spanish_and_german_word = "🇪🇸" + spanish_word + " | " + "🇩🇪" + german_word
inline_keyboard_buttons.append([InlineKeyboardButton(spanish_and_german_word, callback_data=f'/unblockword_fbw {word_id} {current_page}')])

if show_pagination:
inline_keyboard_buttons.append([InlineKeyboardButton("next page ➡", callback_data=f'/blockedwords_{next_page}')])
if n_words > WORDS_PER_PAGE:
page_button_text = "next page ➡" if next_page else "go to first page ↩"
inline_keyboard_buttons.append([InlineKeyboardButton(page_button_text, callback_data=f'/blockedwords_{next_page}')])

reply_markup = InlineKeyboardMarkup(inline_keyboard_buttons)

Expand Down

0 comments on commit 909eab1

Please sign in to comment.