YouTubeLoader / bot /ui /keyboards.py
understanding's picture
Create keyboards.py
286d605 verified
raw
history blame
560 Bytes
# PATH: bot/ui/keyboards.py
from hydrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
from bot.ui.callbacks import set_default_cb
def profiles_keyboard(profiles: list[dict]) -> InlineKeyboardMarkup:
rows = []
for p in profiles:
pid = p["profile_id"]
label = p.get("label") or pid[:6]
rows.append([InlineKeyboardButton(f"Set default: {label}", callback_data=set_default_cb(pid))])
return InlineKeyboardMarkup(rows) if rows else InlineKeyboardMarkup([[InlineKeyboardButton("No profiles", callback_data="noop")]])