fix(chat): catch exception when handling bot message

This commit is contained in:
MingxuanGame
2025-08-18 16:41:11 +00:00
parent 1c65b21bb9
commit be7ca57c41

View File

@@ -81,11 +81,13 @@ class Bot:
if handler is None:
return
else:
try:
res = handler(user, args, session, channel)
if asyncio.iscoroutine(res):
res = await res
reply = res # type: ignore[assignment]
except Exception:
reply = "Unknown error occured."
if reply:
await self._send_reply(user, channel, reply, session)