Spaces:
Runtime error
Runtime error
Update bot/ui/keyboards.py
Browse files- bot/ui/keyboards.py +40 -19
bot/ui/keyboards.py
CHANGED
|
@@ -2,39 +2,60 @@
|
|
| 2 |
from hydrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
| 3 |
from bot.ui.callbacks import (
|
| 4 |
make,
|
| 5 |
-
AUTH_JSON, AUTH_CI, CANCEL,
|
| 6 |
-
MENU_HELP, MENU_AUTH, MENU_PROFILES, MENU_SPEEDTEST
|
|
|
|
| 7 |
)
|
| 8 |
|
| 9 |
-
def
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
def auth_menu_keyboard() -> InlineKeyboardMarkup:
|
| 20 |
return InlineKeyboardMarkup(
|
| 21 |
[
|
| 22 |
-
[InlineKeyboardButton("π Paste
|
| 23 |
-
[InlineKeyboardButton("π
|
| 24 |
-
[InlineKeyboardButton("
|
| 25 |
]
|
| 26 |
)
|
| 27 |
|
| 28 |
-
def
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
return InlineKeyboardMarkup(
|
| 30 |
[
|
|
|
|
| 31 |
[
|
| 32 |
-
InlineKeyboardButton("
|
| 33 |
-
InlineKeyboardButton(
|
| 34 |
],
|
| 35 |
[
|
| 36 |
-
InlineKeyboardButton("
|
| 37 |
-
InlineKeyboardButton("
|
| 38 |
],
|
| 39 |
]
|
| 40 |
)
|
|
|
|
| 2 |
from hydrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
| 3 |
from bot.ui.callbacks import (
|
| 4 |
make,
|
| 5 |
+
AUTH_JSON, AUTH_CI, CANCEL, BACK,
|
| 6 |
+
MENU_HELP, MENU_AUTH, MENU_PROFILES, MENU_SPEEDTEST,
|
| 7 |
+
UP_GO, UP_EDIT, UP_PRIV, UP_CANCEL
|
| 8 |
)
|
| 9 |
|
| 10 |
+
def main_menu_keyboard() -> InlineKeyboardMarkup:
|
| 11 |
+
return InlineKeyboardMarkup(
|
| 12 |
+
[
|
| 13 |
+
[
|
| 14 |
+
InlineKeyboardButton("π Add Profile", callback_data=make(MENU_AUTH)),
|
| 15 |
+
InlineKeyboardButton("π€ Profiles", callback_data=make(MENU_PROFILES)),
|
| 16 |
+
],
|
| 17 |
+
[
|
| 18 |
+
InlineKeyboardButton("β‘ Speedtest", callback_data=make(MENU_SPEEDTEST)),
|
| 19 |
+
InlineKeyboardButton("β Help", callback_data=make(MENU_HELP)),
|
| 20 |
+
],
|
| 21 |
+
]
|
| 22 |
+
)
|
| 23 |
|
| 24 |
def auth_menu_keyboard() -> InlineKeyboardMarkup:
|
| 25 |
return InlineKeyboardMarkup(
|
| 26 |
[
|
| 27 |
+
[InlineKeyboardButton("π Send .json file / Paste JSON", callback_data=make(AUTH_JSON))],
|
| 28 |
+
[InlineKeyboardButton("π Send Client ID + Secret", callback_data=make(AUTH_CI))],
|
| 29 |
+
[InlineKeyboardButton("β¬
οΈ Back", callback_data=make(BACK))],
|
| 30 |
]
|
| 31 |
)
|
| 32 |
|
| 33 |
+
def profiles_keyboard(profiles: list[dict]) -> InlineKeyboardMarkup:
|
| 34 |
+
rows = []
|
| 35 |
+
for i, p in enumerate(profiles, start=1):
|
| 36 |
+
pid = p.get("profile_id") or ""
|
| 37 |
+
ch = (p.get("channel_title") or p.get("label") or "Profile").strip()
|
| 38 |
+
btn = InlineKeyboardButton(f"π’ Set current: [{i}] {ch}", callback_data=f"setdef:{pid}")
|
| 39 |
+
rows.append([btn])
|
| 40 |
+
|
| 41 |
+
rows.append([InlineKeyboardButton("β¬
οΈ Back", callback_data=make(BACK))])
|
| 42 |
+
return InlineKeyboardMarkup(rows)
|
| 43 |
+
|
| 44 |
+
def upload_confirm_keyboard(privacy: str) -> InlineKeyboardMarkup:
|
| 45 |
+
priv_label = {"private": "π Private", "unlisted": "π Unlisted", "public": "π Public"}.get(
|
| 46 |
+
(privacy or "private").lower(),
|
| 47 |
+
"π Private"
|
| 48 |
+
)
|
| 49 |
return InlineKeyboardMarkup(
|
| 50 |
[
|
| 51 |
+
[InlineKeyboardButton("β
Upload", callback_data=make(UP_GO))],
|
| 52 |
[
|
| 53 |
+
InlineKeyboardButton("βοΈ Edit title/desc", callback_data=make(UP_EDIT)),
|
| 54 |
+
InlineKeyboardButton(priv_label, callback_data=make(UP_PRIV)),
|
| 55 |
],
|
| 56 |
[
|
| 57 |
+
InlineKeyboardButton("β Cancel", callback_data=make(UP_CANCEL)),
|
| 58 |
+
InlineKeyboardButton("β¬
οΈ Back", callback_data=make(BACK)),
|
| 59 |
],
|
| 60 |
]
|
| 61 |
)
|