- Эмодзи нестабильно передаются через файловые каналы, заменены на ASCII - menu.py: эмодзи заменены на [текст] для совместимости
21 lines
590 B
Python
21 lines
590 B
Python
from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
|
from app.config import TIME_SLOTS
|
|
|
|
|
|
def get_time_keyboard(busy_times):
|
|
buttons = []
|
|
row = []
|
|
for slot in TIME_SLOTS:
|
|
busy = slot in busy_times
|
|
if busy:
|
|
label = "[X] " + slot
|
|
else:
|
|
label = "[V] " + slot
|
|
row.append(InlineKeyboardButton(text=label, callback_data="time_" + slot))
|
|
if len(row) == 3:
|
|
buttons.append(row)
|
|
row = []
|
|
if row:
|
|
buttons.append(row)
|
|
return InlineKeyboardMarkup(inline_keyboard=buttons)
|