telegram-bot/telegram_helpers.py

11 lines
357 B
Python
Raw Permalink Normal View History

2021-02-11 21:54:50 +01:00
def build_menu(buttons: [],
n_cols: int,
header_buttons: [] = None,
footer_buttons: [] = None):
menu = [buttons[i:i + n_cols] for i in range(0, len(buttons), n_cols)]
if header_buttons:
menu.insert(0, [header_buttons])
if footer_buttons:
menu.append([footer_buttons])
return menu