This commit is contained in:
ilyastar9999
2025-12-04 14:19:15 +03:00
parent 8ab144796f
commit 154c0cda75
2 changed files with 67 additions and 14 deletions

View File

@@ -140,8 +140,11 @@ async def socketio_listener():
)
if service_row:
service_id = service_row['id']
except:
pass
print(f" Found service_id: {service_id} for service: {service_name}")
else:
print(f" Service {service_name} not found in services table, buttons will use service_name only")
except Exception as e:
print(f" Error looking up service_id: {e}")
alert_id = await conn.fetchval("""
INSERT INTO attack_alerts (attack_id, alert_type, severity, message)
@@ -153,6 +156,8 @@ async def socketio_listener():
)
RETURNING id
""", attack_id, alert_message)
print(f" Calling send_telegram_alert with service_id={service_id}, service_name={service_name}")
await send_telegram_alert(alert_message, service_id=service_id, service_name=service_name)
await conn.execute("UPDATE attack_alerts SET notified = true WHERE id = $1", alert_id)
print(f" Alert sent successfully")