Spaces:
Runtime error
Runtime error
Update bot/ui/keyboards.py
Browse files- bot/ui/keyboards.py +12 -3
bot/ui/keyboards.py
CHANGED
|
@@ -1,11 +1,20 @@
|
|
| 1 |
# PATH: bot/ui/keyboards.py
|
| 2 |
from hydrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
| 3 |
-
from bot.ui.callbacks import
|
| 4 |
|
| 5 |
def profiles_keyboard(profiles: list[dict]) -> InlineKeyboardMarkup:
|
| 6 |
rows = []
|
| 7 |
for p in profiles:
|
| 8 |
pid = p["profile_id"]
|
| 9 |
label = p.get("label") or pid[:6]
|
| 10 |
-
rows.append([InlineKeyboardButton(f"Set default: {label}", callback_data=
|
| 11 |
-
return InlineKeyboardMarkup(rows) if rows else InlineKeyboardMarkup([[InlineKeyboardButton("No profiles", callback_data="noop")]])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# PATH: bot/ui/keyboards.py
|
| 2 |
from hydrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
| 3 |
+
from bot.ui.callbacks import make, AUTH_JSON, AUTH_CI, CANCEL
|
| 4 |
|
| 5 |
def profiles_keyboard(profiles: list[dict]) -> InlineKeyboardMarkup:
|
| 6 |
rows = []
|
| 7 |
for p in profiles:
|
| 8 |
pid = p["profile_id"]
|
| 9 |
label = p.get("label") or pid[:6]
|
| 10 |
+
rows.append([InlineKeyboardButton(f"Set default: {label}", callback_data=f"setdef:{pid}")])
|
| 11 |
+
return InlineKeyboardMarkup(rows) if rows else InlineKeyboardMarkup([[InlineKeyboardButton("No profiles", callback_data="noop")]])
|
| 12 |
+
|
| 13 |
+
def auth_menu_keyboard() -> InlineKeyboardMarkup:
|
| 14 |
+
return InlineKeyboardMarkup(
|
| 15 |
+
[
|
| 16 |
+
[InlineKeyboardButton("📄 Paste client JSON", callback_data=make(AUTH_JSON))],
|
| 17 |
+
[InlineKeyboardButton("🔑 Enter Client ID & Secret", callback_data=make(AUTH_CI))],
|
| 18 |
+
[InlineKeyboardButton("❌ Cancel", callback_data=make(CANCEL))],
|
| 19 |
+
]
|
| 20 |
+
)
|