Python error handling (sends Discord DM)

This commit is contained in:
2025-02-18 14:22:26 +01:00
parent 7fc23896cb
commit cb2b5a508e
4 changed files with 39 additions and 3 deletions
+6
View File
@@ -16,6 +16,12 @@ async def send_message(message: str):
await ws_global.send(message)
async def send_internal_error(e: Exception):
global ws_global
if ws_global:
await ws_global.send(f"json:{{\"error\":\"Internal Python error: {e}\"}}")
async def websocket_client(bot: botPy.Bot):
global ws_global, is_connected
port = bot.args["port"]