29 Commits

Author SHA1 Message Date
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
gitea 759c04a48f add 2026-07-07 23:24:12 +02:00
Michal Tuszowski 5adeb1b384 Land prototype on main (fix stacked-PR retarget gap)
PRs #10 and #11 were merged into their intermediate base branches
(restructure/working-copy-root and proto-improvements) rather than main,
because the stacked PRs' bases were not auto-retargeted (the branches were
not deleted on merge). As a result main only received the #9 restructure
and is still the plain working-copy bot.

This brings the full prototype onto main as a clean delta on top of the
current main tree (identical content to proto-improvements, but with main
ancestry so it merges without the squash-induced rename/delete conflicts):

- constants.py: env-var config, safe JSON loading, dependency guards,
  env->netrc tokens, API_SHARED_KEY + service_headers(), CONAN_* config
- communication_subroutine.py: queue timeout/Empty, daemon threads,
  cooperative stop_event, inbound _authorize_request()
- bot.py: asyncio event loop + load conanjurer_commands
- music_functions / radio_commands / librarian_commands: X-Conjurer-Api-Key
- conanjurer_commands/_functions: fixed + integrated bridge with RCON
  player-join notifications
- requirements_bot.txt: aiomcrcon, asyncssh
- conjurer_musician/.gitignore: keep runtime playlists/mp3 out of the repo

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 11:28:14 +02:00
Michal Tuszowski a64fb2da57 Restructure: promote working_copy to repo root
Make the stable 'working copy' bot the canonical code at the repository
root so the install/deploy scripts operate against it again.

- Move working_copy/* to root (bot entrypoint is bot.py)
- Restore root-level install/ops scripts from c4fa88e (deploy.sh,
  install_main_bot.sh, status_report.*, conjurer.service, etc.)
- Fix deploy.sh: copy bot.py (was thin_client.py) and add the
  conanjurer_* modules; bump command count
- Remove side-by-side variant dirs (backup_old_docker, prototype_one,
  prototype_musician_one, musician_old, working_copy) and docker cruft
- Keep components as subdirs: conjurer_librarian, conjurer_musician,
  spotify_dl, yt_dlp, fonts, utils, docs

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 23:50:55 +02:00
Michal Tuszowski 8e5e4ce530 Backup old. Preparation for forking 2026-06-16 14:09:27 +02:00
gitea f9ad679833 Dockerization + ai review recomendations. 2025-10-29 14:57:43 +01:00
gitea 9a0f869839 Main refactoring 2024-11-10 15:03:44 +01:00
gitea 215a36f91e Fx 2024-08-09 17:10:14 +02:00
gitea ecabfc8876 fx 2024-08-09 17:06:01 +02:00
gitea 20f045e92a fx 2024-08-09 17:03:15 +02:00
gitea c90e90ea10 Port fix 2024-08-09 17:02:05 +02:00
gitea 8c6e80d832 Fix 2024-08-09 16:53:17 +02:00
gitea 96b93488c7 1 2024-08-09 16:47:35 +02:00
gitea c31390859f Metadata 2024-08-09 16:43:52 +02:00
gitea 0345573cb8 fx 2024-08-03 16:38:42 +02:00
gitea 4842ccdc22 Music trackin upgrade 2024-08-03 15:34:56 +02:00
gitea a827c5e429 Fix tracker 2024-08-02 19:22:25 +02:00
gitea 71d8e03933 fx 2024-08-02 12:32:44 +02:00
gitea 81d5fcfb8f Now playing 2024-08-02 12:10:55 +02:00
gitea c728396205 tst fx 2024-08-02 11:58:51 +02:00
gitea 1ebd58b8ac UPdate for music tracker 2024-08-02 11:43:38 +02:00
gitea 82bb6cbbad fx 2024-08-01 18:18:26 +02:00
gitea e54150fd5d fx 2024-08-01 18:07:50 +02:00
gitea 167fe59456 logg 2024-08-01 17:58:40 +02:00
gitea 5d51e99c70 Music tracker 2024-08-01 17:35:54 +02:00
gitea 430b4de995 Search headless (#8)
* Fix

* Final fix to headless

* test

* Fix

* Ready for deployment
2024-04-24 17:31:52 +02:00
gitea 082b25c89c Music tunneling (#7)
* New requirement

* SMall fixes for tunnel

* First step towards cogization

* Tmp chng

* Testing of new functions in conjurer_musician.py and radio_conjurer.liq

* Fixes!

* Fix fix

* Mostly working ?

* Requests

* Fixes

* Fix

* Radio requests

* Radio hardkor

* Fix

* Fixes

* Change log to print

* Clearing fetch failed

* Small fix

* sx

* Fix fix fix

* test

* el fixo stupido

* test

* Maybe fix ?

* FIX!

* Fix fix fix

* FIx of volume
2024-04-23 12:59:33 +02:00
gitea d912d9bc1b Main bot (#1)
undefined
2024-04-12 23:20:51 +02:00
gitea 89003c32c9 Serverside work of search 2024-04-10 15:26:40 +02:00