Michal Tuszowski 460cf072ad fix: never swallow task exceptions - diagnose WHY the bot died
The restart-loop with only 'Starting discord bot' in the logs was caused by
gather(return_exceptions=True) eating the client.start() exception: a failed
login looked like a clean exit and docker just restarted the container.

bot.py:
- _run_bot: catch discord.LoginFailure / PrivilegedIntentsRequired with
  CRITICAL messages telling exactly what to fix (token entry / Developer
  Portal intents), full traceback for anything else, then re-raise
- main() returns an exit code; every task exception is re-logged as the
  LAST line in docker logs ('Task died: ...'); process exits 1 on failure
- log the token source (env vs netrc) and its length at startup to catch
  truncated/wrong-field netrc entries
- _run_comm_subroutine: comm crash is logged loudly but no longer relies on
  gather to surface it (bot keeps running - Discord side is independent)

communication_subroutine.py (crash found by the new stub tests):
- comm_subroutine used 'logger' before its local assignment
  (UnboundLocalError killed the whole comm layer at every startup)
- re-comment the flask_debug thread: it binds the same host:port as
  waitress, so running both dies with 'address in use'

Verified via stub-injected client: LoginFailure -> CRITICAL + exit 1,
PrivilegedIntentsRequired -> CRITICAL + exit 1, unknown exception -> full
traceback + exit 1, clean shutdown -> exit 0; comm layer no longer crashes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 01:07:18 +02:00
2026-06-29 12:27:32 +02:00
2024-06-19 17:46:38 +02:00
2024-04-10 14:22:00 +02:00
2025-08-20 21:21:15 +02:00
2025-04-09 18:21:37 +01:00
2024-04-28 12:27:29 +02:00
2025-01-05 22:09:43 +01:00
2024-11-14 00:14:49 +01:00
2023-06-05 21:31:57 +02:00
2025-04-19 17:15:11 +02:00
2024-11-11 15:38:32 +01:00
2025-04-19 17:15:11 +02:00
2024-06-19 16:26:48 +01:00
2024-11-10 23:01:00 +00:00
2024-11-11 20:12:47 +00:00
2024-11-14 00:14:49 +01:00
2024-11-14 00:14:49 +01:00

conjurer

Discord.py bot for fun, sex and BDSM

S
Description
No description provided
Readme Unlicense 12 MiB
Languages
Python 99.7%
Shell 0.3%