From 0aa9950e1829cf1939eac46c60c63ca96af1b817 Mon Sep 17 00:00:00 2001 From: ben Date: Thu, 2 Apr 2026 12:19:56 -0400 Subject: [PATCH] cleanup discord adapter artifacts --- README.md | 10 +++---- pm/tasks-v2.org | 53 +++++++++++++++++++++++++++++++++----- unraid-ca-template.xml | 6 ++--- youdis/adapters/discord.py | 6 ----- 4 files changed, 55 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 28a6542..1e43bc2 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ v2 architecture draft: see `docs/architecture-v2.org` build and run the docker container ``` -api_token = [discord bot token] +DISCORD_BOT_TOKEN = [discord bot token] -v [downloads]:/downloads --v [config]:/config -``` -config contains data to persist across container updates, i.e., unraid appdata, -such as users.json (authorized users) and yt-dlp's archive.txt +-v [config]:/config +``` +config contains data to persist across container updates, i.e., unraid appdata, +such as yt-dlp's archive.txt diff --git a/pm/tasks-v2.org b/pm/tasks-v2.org index afa6421..b6f23c3 100644 --- a/pm/tasks-v2.org +++ b/pm/tasks-v2.org @@ -98,7 +98,7 @@ user@paladin:~/proj/youdis$ curl http://127.0.0.1:8000/jobs/current - local dev now falls back to repo-local `.runtime/{config,downloads}` when `/config` or `/downloads` are not writable - had to uninstall yt-dlp python pkg from the venv, which resulted in a '403 Forbidden' -* [ ] 2.0.2: update discord bot to use new backend (3) +* [X] 2.0.2: update discord bot to use new backend (3) update the discord bot into a thin frontend that talks to the backend and verify the flow end to end ** pm notes - this is the first real frontend proof. once this works cleanly, zulip/xmpp should mostly be adapter work rather than downloader rewrites. @@ -121,7 +121,7 @@ update the discord bot into a thin frontend that talks to the backend and verify - populate .env with dev env defaults ** evidence -- commit: +- commit: 5210d2c, 043cb4 - tests: https://youtu.be/20HxMMSqRyg?si=3v7mN2L88c_FxpQR 18m 1. start backend: `python3 -m uvicorn youdis.main:app --host 127.0.0.1 --port 8000` 2. create local env file: `cp .env.example .env` @@ -205,9 +205,9 @@ python ./youdis.py - discord adapter is now a thin HTTP client of the backend; it no longer imports or configures yt-dlp - `YOUDIS_BACKEND_URL` controls which backend the adapter targets - progress updates are currently implemented by polling `/jobs/current` and DMing only when the summary changes -- legacy auth/user-management commands were removed from the active adapter path and should be cleaned up formally in `2.0.3` +- legacy auth/user-management commands were removed from the active adapter path - `.env` is now supported for local/dev convenience, while real environment variables still override it in prod/docker -- submitting via DM doesn't work +- command registration required explicit binding plus `@bot.listen()` listeners in this adapter structure * [ ] 2.0.3: remove deprecated discord-bot functionality (2) delete or retire legacy bot behaviors that no longer fit once the backend split is in place ** pm notes @@ -227,11 +227,20 @@ delete or retire legacy bot behaviors that no longer fit once the backend split - deprecated artifacts are clearly removed or marked ** evidence -- commit: +- commit: - tests: -- datetime: + 1. `python3 -m py_compile ./youdis.py ./youdis/adapters/discord.py` + 2. `rg -n "users.json|api_token" README.md unraid-ca-template.xml youdis.py youdis/adapters/discord.py` + 3. start backend: `python3 -m uvicorn youdis.main:app --host 127.0.0.1 --port 8000` + 4. start adapter: `python3 ./youdis.py` + 5. in discord, run `/youtube`, `/status`, and `/interrupt` and confirm the adapter still works after cleanup +- datetime: [2026-04-02 Thu 12:09] ** notes +- active bot path no longer includes local auth or user-management behavior +- top-level `youdis.py` remains as a thin launcher so existing operator habits and scripts do not break during the refactor +- cleanup updated user-facing deployment artifacts to match the v2 naming and architecture, including `DISCORD_BOT_TOKEN` and removal of `users.json` references +- archived planning docs were intentionally left untouched: `pm/tasks.org` is historical and `pm/notes.org` is personal working notes * [ ] 2.0.4: fix automation and build pipeline (3) repair and simplify the build/update/deploy path so it matches the new backend-plus-frontend structure @@ -257,3 +266,35 @@ repair and simplify the build/update/deploy path so it matches the new backend-p - datetime: ** notes + +* ==== BACKLOG ==== +Tasks below this line are inactive and should not be touched. +* [ ] X.x.x: clean up discord adapter UI + +** acceptance criteria +1. fix interaction pattern so it doesnt time out - prefer "command accepted" or somehting +2. remove all intermediate messages between "accepted/running" and "complete" - /status handles this! + - discord can also output a "busy" signal, research this +3. fix output syntax, we dont need to get crazy with discord cards + +** evidence +- commit: +- tests: +- date: + +** notes + +* [ ] X.x.x: fix youtube -> plex default output + +** acceptance criteria +1. +- + +** evidence +- commit: +- tests: +- date: + +** notes + +* / diff --git a/unraid-ca-template.xml b/unraid-ca-template.xml index 0c421a4..900fe98 100644 --- a/unraid-ca-template.xml +++ b/unraid-ca-template.xml @@ -8,11 +8,11 @@ false [Unraid Support Thread] https://github.com/eulaly/youdis - Discord bot-based wrapper for yt-dlp. Let your friends download videos to your server! Supports playlists, requires a configured Discord bot. + Private yt-dlp worker with a Discord adapter. Submit downloads through Discord while the backend owns yt-dlp execution and job state. Downloaders: Tools: https://raw.githubusercontent.com/eulaly/unraid-templates/refs/heads/master/unraid-ca-template.xml https://github.com/eulaly/youdis/blob/c978a2326984efa9670678687ed1a1473478d753/yt_dlp.png - + - + diff --git a/youdis/adapters/discord.py b/youdis/adapters/discord.py index 000d0a1..30823c8 100644 --- a/youdis/adapters/discord.py +++ b/youdis/adapters/discord.py @@ -116,12 +116,6 @@ def ensure_poll_task(ctx: interactions.SlashContext, job_id: str) -> None: async def on_startup(): await get_session() print(f"discord adapter configured for backend {BACKEND_URL}") - print(f"discord adapter default scope: {DEFAULT_SCOPE}") - print(f"discord adapter command cache keys: {sorted(bot._interaction_lookup.keys())}") - -@bot.listen() -async def on_ready(): - print(f"registered commands: {bot.application_commands}") @bot.listen() async def on_shutdown():