understanding commited on
Commit
40d9cf1
Β·
verified Β·
1 Parent(s): 3f58228

Update bot/ui/keyboards.py

Browse files
Files changed (1) hide show
  1. bot/ui/keyboards.py +23 -3
bot/ui/keyboards.py CHANGED
@@ -1,14 +1,20 @@
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(
@@ -17,4 +23,18 @@ def auth_menu_keyboard() -> InlineKeyboardMarkup:
17
  [InlineKeyboardButton("πŸ”‘ Enter Client ID & Secret", callback_data=make(AUTH_CI))],
18
  [InlineKeyboardButton("❌ Cancel", callback_data=make(CANCEL))],
19
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  )
 
1
  # PATH: bot/ui/keyboards.py
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 profiles_keyboard(profiles: list[dict]) -> InlineKeyboardMarkup:
10
  rows = []
11
  for p in profiles:
12
  pid = p["profile_id"]
13
  label = p.get("label") or pid[:6]
14
+ rows.append([InlineKeyboardButton(f"🟒 Set current: {label}", callback_data=f"setdef:{pid}")])
15
+ if not rows:
16
+ rows = [[InlineKeyboardButton("No profiles", callback_data="noop")]]
17
+ return InlineKeyboardMarkup(rows)
18
 
19
  def auth_menu_keyboard() -> InlineKeyboardMarkup:
20
  return InlineKeyboardMarkup(
 
23
  [InlineKeyboardButton("πŸ”‘ Enter Client ID & Secret", callback_data=make(AUTH_CI))],
24
  [InlineKeyboardButton("❌ Cancel", callback_data=make(CANCEL))],
25
  ]
26
+ )
27
+
28
+ def main_menu_keyboard() -> InlineKeyboardMarkup:
29
+ return InlineKeyboardMarkup(
30
+ [
31
+ [
32
+ InlineKeyboardButton("πŸ” Add Profile", callback_data=make(MENU_AUTH)),
33
+ InlineKeyboardButton("πŸ‘€ Profiles", callback_data=make(MENU_PROFILES)),
34
+ ],
35
+ [
36
+ InlineKeyboardButton("⚑ Speedtest", callback_data=make(MENU_SPEEDTEST)),
37
+ InlineKeyboardButton("❓ Help", callback_data=make(MENU_HELP)),
38
+ ],
39
+ ]
40
  )