def deck_buttons(deck, chat_id): buttons = [] for deck_name in deck: buttons.append( InlineKeyboardButton( deck_name, callback_data=f"deck_{str(chat_id)}_{deck_name}")) return build_menu(buttons, 3)
def deck_languages_buttons(languages, chat_id): buttons = [] for language in languages: buttons.append( InlineKeyboardButton( language, callback_data=f"0deck_{str(chat_id)}_{language}")) return build_menu(buttons, 3)
def language_buttons(languages): buttons = [] for language in languages: buttons.append( InlineKeyboardButton(languages[language], callback_data=f"privatelanguage_{language}")) return build_menu(buttons, 3)
def language_buttons(languages, chat_id): buttons = [] for language in languages: buttons.append( InlineKeyboardButton( languages[language], callback_data=f"grouplanguage_{str(chat_id)}_{language}")) return build_menu(buttons, 3)
def draw_buttons(same_voters, game_id): buttons = [] for same_voter in same_voters: buttons.append( InlineKeyboardButton(same_voter["first_name"], callback_data="draw" + game_id + str(same_voter["user_id"]))) return build_menu(buttons, 3)
def vote_buttons(players, game_id): buttons = [] for player in players: buttons.append( InlineKeyboardButton(player["first_name"], callback_data="vote" + game_id + str(player["user_id"]))) return build_menu(buttons, 3)
def help_buttons(settings, chosen): buttons = [] for setting in settings: if setting == "refresh": continue data = f"settingshelp_{setting}" if setting == chosen: buttons.append( InlineKeyboardButton(f"[{settings[setting]}]", callback_data=data)) else: buttons.append( InlineKeyboardButton(settings[setting], callback_data=data)) return build_menu(buttons, 4)
def group_settings_buttons(settings, chat_id, ref=0): buttons = [] refresh_button = [] group_settings = database.get_all_settings(chat_id) if not group_settings: new_id = database.get_new_id(chat_id) if new_id: group_settings = database.get_all_settings(chat_id) else: return None for setting in settings: if setting == "language": buttons.append( InlineKeyboardButton( f"{settings[setting]}: {get_language(group_settings['lang'])}", callback_data= f"groupsettings_{str(chat_id)}_{setting}_{ref}")) elif setting == "deck": buttons.append( InlineKeyboardButton( f"{settings[setting]}: {group_settings['deck']}", callback_data= f"groupsettings_{str(chat_id)}_{setting}_{ref}")) elif setting == "refresh": refresh_button.append( InlineKeyboardButton( f"{settings[setting]} 🔄", callback_data= f"groupsettings_{str(chat_id)}_{setting}_{ref}")) elif group_settings[setting]: buttons.append( InlineKeyboardButton( f"{settings[setting]} ✅", callback_data= f"groupsettings_{str(chat_id)}_{setting}_{ref}")) else: buttons.append( InlineKeyboardButton( f"{settings[setting]} ❌", callback_data= f"groupsettings_{str(chat_id)}_{setting}_{ref}")) return build_menu(buttons, 2, header_buttons=refresh_button)
def word_buttons(words): buttons = [] for word in words: buttons.append(KeyboardButton(word)) return build_menu(buttons, 4)
def word_buttons(words, exclamation_mark=False): buttons = [] for word in words: buttons.append( KeyboardButton(f"{'!' if exclamation_mark else ''}{word}")) return build_menu(buttons, 4)