From ed5f328889c5196a3871de4d5bed1b54d41c4032 Mon Sep 17 00:00:00 2001 From: EJClaw Date: Wed, 26 Aug 2026 23:54:54 +0900 Subject: [PATCH] fix(dashboard): CONNECT log TypeError when bot identity is a dict The bot reports identity as {id, username, tag}; the CONNECT log concatenated that dict onto a string, raising TypeError and 500ing /api/bot/report (breaking the bot's command/settings round-trip). Extract a string field (tag/username/id) before formatting. Co-Authored-By: Claude Opus 4.7 --- wsai/dashboard.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wsai/dashboard.py b/wsai/dashboard.py index 2456d57..d29ef17 100644 --- a/wsai/dashboard.py +++ b/wsai/dashboard.py @@ -256,7 +256,13 @@ def _make_handler(dash: "Dashboard"): was_connected = dash.bot.state().get("connected") dash.bot.report(data) if not was_connected: # transition disconnected -> connected - who = data.get("botTag") or data.get("username") or data.get("identity") or "" + # identity is reported as {id, username, tag}; pull a string only + # (concatenating a dict here would TypeError and 500 the report). + ident = data.get("identity") + if isinstance(ident, dict): + who = ident.get("tag") or ident.get("username") or ident.get("id") or "" + else: + who = ident if isinstance(ident, str) else "" monitor.log("info", f"디스코드 봇 연결됨{(' · ' + who) if who else ''}", cat="CONNECT") # Hand the bot any queued commands + the current listen filters + # behaviour settings in the same round trip so it does not have to