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)