vwxyzarii commited on
Commit
4721448
·
verified ·
1 Parent(s): 05ff3d4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -25,7 +25,7 @@ client = TelegramClient(
25
  )
26
 
27
  # =========================
28
- # AUTO BOT CONFIG (ROBUST INDEX)
29
  # =========================
30
  BOT_CONFIG = {}
31
 
@@ -44,7 +44,8 @@ for idx in sorted(indexes):
44
  url = os.getenv(f"BOT_URL_{idx}")
45
 
46
  if username and url:
47
- BOT_CONFIG[username] = url
 
48
 
49
  print("Loaded BOT_CONFIG:", BOT_CONFIG)
50
 
@@ -63,6 +64,8 @@ async def startup():
63
  @app.get("/open/{bot_username}")
64
  async def open_webview(bot_username: str):
65
 
 
 
66
  if bot_username not in BOT_CONFIG:
67
  return {"error": "Bot tidak terdaftar"}
68
 
 
25
  )
26
 
27
  # =========================
28
+ # AUTO BOT CONFIG (ROBUST + NORMALIZE)
29
  # =========================
30
  BOT_CONFIG = {}
31
 
 
44
  url = os.getenv(f"BOT_URL_{idx}")
45
 
46
  if username and url:
47
+ clean_username = username.lstrip("@") # 🔥 normalize
48
+ BOT_CONFIG[clean_username] = url
49
 
50
  print("Loaded BOT_CONFIG:", BOT_CONFIG)
51
 
 
64
  @app.get("/open/{bot_username}")
65
  async def open_webview(bot_username: str):
66
 
67
+ bot_username = bot_username.lstrip("@") # 🔥 normalize input
68
+
69
  if bot_username not in BOT_CONFIG:
70
  return {"error": "Bot tidak terdaftar"}
71