asd
This commit is contained in:
@@ -49,7 +49,7 @@ async def handle_button_click(callback_data: str, chat_id: int, message_id: int)
|
||||
# Extract service name from identifier
|
||||
service_name = identifier[5:] # Remove 'name_' prefix
|
||||
service_id = None
|
||||
print(f"[BUTTON] Looking up service by name: {service_name}")
|
||||
print(f"[BUTTON] Looking up service by name or alias: {service_name}")
|
||||
|
||||
# Look up service_id from controller API
|
||||
try:
|
||||
@@ -60,16 +60,17 @@ async def handle_button_click(callback_data: str, chat_id: int, message_id: int)
|
||||
print(f"[BUTTON] Controller response: HTTP {resp.status}")
|
||||
if resp.status == 200:
|
||||
services = await resp.json()
|
||||
print(f"[BUTTON] Found {len(services)} services: {[s.get('name') for s in services]}")
|
||||
# Find service by name
|
||||
print(f"[BUTTON] Found {len(services)} services")
|
||||
# Find service by name or alias
|
||||
for svc in services:
|
||||
if svc.get('name') == service_name:
|
||||
if svc.get('name') == service_name or svc.get('alias') == service_name:
|
||||
service_id = svc.get('id')
|
||||
print(f"[BUTTON] Matched service '{service_name}' to ID {service_id}")
|
||||
matched_by = "name" if svc.get('name') == service_name else "alias"
|
||||
print(f"[BUTTON] Matched service '{service_name}' to ID {service_id} (by {matched_by})")
|
||||
break
|
||||
|
||||
if not service_id:
|
||||
error_msg = f"❌ Service '{service_name}' not registered in controller"
|
||||
error_msg = f"❌ Service '{service_name}' not registered in controller\nPlease add alias in web panel"
|
||||
print(f"[BUTTON] {error_msg}")
|
||||
await bot.edit_message_text(
|
||||
chat_id=chat_id,
|
||||
|
||||
Reference in New Issue
Block a user