Dezio: an all-in-one Discord bot in Rust
Music with a live player, Last.fm, video downloads, games, AI chat, moderation, logging, a web dashboard and a Game Boy Activity. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
commit
709f9b707a
149 changed files with 39502 additions and 0 deletions
6
.env.example
Normal file
6
.env.example
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
DISCORD_BOT_TOKEN=
|
||||
LASTFM_API_KEY=
|
||||
OPENROUTER_KEY=
|
||||
STEAMGRIDDB_API_KEY=
|
||||
DASHBOARD_URL=
|
||||
DASHBOARD_CLIENT_SECRET=
|
||||
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
/target
|
||||
.env
|
||||
data/
|
||||
|
||||
# Game Boy ROMs are never committed (copyrighted); the library folders are filled on the host
|
||||
/assets/roms/*/
|
||||
6644
Cargo.lock
generated
Normal file
6644
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
47
Cargo.toml
Normal file
47
Cargo.toml
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
[package]
|
||||
name = "dezio"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
ab_glyph = "0.2.32"
|
||||
anyhow = "1.0.104"
|
||||
async-trait = "0.1.92"
|
||||
axum = "0.8"
|
||||
base64 = "0.23.1"
|
||||
chrono = { version = "0.4.45", default-features = false, features = ["clock", "std"] }
|
||||
cosmic-text = { version = "0.19.0", default-features = false, features = ["std", "swash"] }
|
||||
dotenvy = "0.15.7"
|
||||
futures = "0.3.34"
|
||||
html-escape = "0.3.0"
|
||||
image = { version = "0.25.10", default-features = false, features = ["png", "jpeg", "webp", "gif"] }
|
||||
mime_guess = "2.0.5"
|
||||
num-bigint = "0.5.1"
|
||||
num-traits = "0.2.19"
|
||||
rand = "0.10.3"
|
||||
ratatui = "0.30.2"
|
||||
regex = "1.13.1"
|
||||
reqwest = { version = "0.13.5", default-features = false, features = ["form", "json", "multipart", "query", "rustls"] }
|
||||
rustls = { version = "0.23.46", default-features = false, features = ["ring", "std"] }
|
||||
scraper = "0.29.0"
|
||||
serde = { version = "1.0.229", features = ["derive"] }
|
||||
serde_json = { version = "1.0.154", features = ["preserve_order"] }
|
||||
sha1 = "0.11.0"
|
||||
sha2 = "0.11.1"
|
||||
shakmaty = "0.30.2"
|
||||
songbird = { version = "0.6.1", default-features = false, features = ["driver", "gateway", "rustls", "twilight", "tungstenite"] }
|
||||
symphonia = { version = "0.5.5", default-features = false, features = ["pcm"] }
|
||||
tokio = { version = "1.54.1", features = ["full"] }
|
||||
tower-http = { version = "0.6", features = ["fs"] }
|
||||
tracing = "0.1.44"
|
||||
tracing-subscriber = { version = "0.3.23", features = ["env-filter"] }
|
||||
twilight-cache-inmemory = "0.17.1"
|
||||
twilight-gateway = "0.17.1"
|
||||
twilight-http = "0.17.1"
|
||||
twilight-model = "0.17.1"
|
||||
twilight-util = { version = "0.17.0", features = ["builder", "permission-calculator"] }
|
||||
url = "2.5.8"
|
||||
urlencoding = "2.1.3"
|
||||
|
||||
[dev-dependencies]
|
||||
tower = { version = "0.5", features = ["util"] }
|
||||
69
README.md
Normal file
69
README.md
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
<p align="center"><img src="assets/images/banner.jpg" alt="Dezio" width="720"></p>
|
||||
|
||||
<h1 align="center">Dezio</h1>
|
||||
|
||||
<p align="center">
|
||||
An all-in-one Discord bot written in Rust — music with a live player, Last.fm, video downloads, games, AI chat,
|
||||
moderation, logging and a web dashboard.
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://discord.com/oauth2/authorize?client_id=1387839600017412106&scope=bot%20applications.commands&permissions=8"><b>➕ Add to your server</b></a> ·
|
||||
<a href="https://archlinux.tail7c4f5e.ts.net">Website</a> ·
|
||||
<a href="https://discord.gg/UnSga5DmR7">Support server</a>
|
||||
</p>
|
||||
|
||||
---
|
||||
|
||||
## What it does
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| 🎵 **Music** | Songs and playlists from a search or link, a live player with buttons, `/music`, vote-skip, read-ahead buffering for slow connections, auto-leave |
|
||||
| 📊 **Last.fm** | Now playing, top artists/albums/tracks, collages, "Who knows?" charts, lyrics, Pixel Jumble |
|
||||
| ⬇️ **Downloads** | TikTok, Instagram, YouTube, X, Reddit and more — converted while downloading, sized for Discord |
|
||||
| 🛡️ **Moderation & logs** | Kick, ban, timeout, purge (15 filters), locks, slowmode, full event logging |
|
||||
| 👋 **Server setup** | Welcome cards, autoroles, sticky roles, reaction roles, role menus, media-only and voting channels |
|
||||
| 🎮 **Games & casino** | Chess, Connect 4, Wordle, Akinator, Cookie Clicker, blackjack, slots, roulette … |
|
||||
| 🤖 **Fun** | AI chat, GIF actions, confessions, phone calls between servers, styled quotes |
|
||||
| 🕹️ **Game Boy** | A Game Boy you can play inside Discord (Activity) |
|
||||
| ⚙️ **Dashboard** | Sign in with Discord to change settings, quote style and role menus |
|
||||
|
||||
Every command works as a slash command and most with the `D!` prefix. Run `/help` for the full list.
|
||||
|
||||
## Built with
|
||||
|
||||
[twilight](https://github.com/twilight-rs/twilight) (gateway, HTTP, cache) · [songbird](https://github.com/serenity-rs/songbird) (voice) ·
|
||||
tokio · axum (dashboard) · ratatui (console) · cosmic-text (text and emoji drawing) · yt-dlp and ffmpeg (media)
|
||||
|
||||
## Run it yourself
|
||||
|
||||
You need Rust, `ffmpeg`, `yt-dlp` and `curl` on the host (plus `libopus`).
|
||||
|
||||
```bash
|
||||
cp .env.example .env # DISCORD_BOT_TOKEN=… (and optional keys, see below)
|
||||
cargo build --release
|
||||
DEZIO_LIVE=1 ./target/release/dezio # console UI in a terminal
|
||||
DEZIO_LIVE=1 ./target/release/dezio --headless # plain logs (for a service)
|
||||
```
|
||||
|
||||
Without `DEZIO_LIVE=1` it only lists its commands and exits, so tests never touch Discord.
|
||||
`cargo test` runs the unit tests (some live tests are `#[ignore]`d and need the internet).
|
||||
|
||||
Optional settings (environment or `.env`): `LASTFM_API_KEY`, `OPENROUTER_KEY` (AI chat), `STEAMGRIDDB_API_KEY` (Game Boy
|
||||
covers), `DASHBOARD_URL`, `DASHBOARD_CLIENT_SECRET`, `DASHBOARD_HOST` / `DASHBOARD_PORT`, `IG_COOKIES`.
|
||||
|
||||
Data lives in `data/*.json`. Game Boy ROMs are **not** included — put your own in `assets/roms/<group>/`.
|
||||
|
||||
## Layout
|
||||
|
||||
```
|
||||
src/commands/ one folder or file per feature (music, lastfm, media, games, fun, logs …)
|
||||
src/web/ dashboard + Game Boy Activity server
|
||||
src/tui.rs terminal console
|
||||
assets/ fonts, images, word lists, presets
|
||||
web/ website, dashboard and Activity pages
|
||||
docs/ Top.gg listing text
|
||||
```
|
||||
|
||||
Project history and decisions are in [ROADMAP.md](ROADMAP.md).
|
||||
101
ROADMAP.md
Normal file
101
ROADMAP.md
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
# Dezio (Rust) — roadmap
|
||||
|
||||
Port of the Python bot in `~/Projects/Discord Bot` (kept until this reaches parity). Backups: `~/Projects/Discord Bot-backups/dezio-python-2026-10-23.tar.gz`, Chromebook `/root/dezio-python-2026-10-23-pre-rust.tar.gz`.
|
||||
|
||||
Stack: tokio, twilight (gateway/http/model — has Components V2 `Container` etc.), songbird for voice, serde. Build on the PC (`~/.cargo/env`), copy the release binary to the Chromebook (x86_64).
|
||||
Never log in with the real token on the PC (the live bot would answer twice).
|
||||
|
||||
Order: 1 core (config, JsonStore with debounce, V2 card builder, command framework, prefix `D!` + slash) → 2 admin/moderation/logs → 3 utility/search/info/help → 4 media (/download incl. parallel convert) → 5 fun/AI/games/casino → 6 music + Last.fm → 7 dashboard + Game Boy Activity server + TUI → 8 data migration check against the old `data/*.json`.
|
||||
|
||||
FINAL STEP (owner request): fix the Chromebook's start-at-boot service (systemd unit for the Rust binary; previously the bot ran by hand in screen).
|
||||
|
||||
## Status
|
||||
- Stage 1 (2026-10-23): paths, JsonStore (same file format, debounced atomic saves), V2 `Card` builder, one command framework for `D!` + slash (per-guild prefix from data/prefixes.json, permission check, user-install contexts, slash sync with hash), commands `ping` and `prefix`. 5 unit tests pass; release binary builds (14 MB). NOT run against Discord: the bot only connects when `DEZIO_LIVE=1` (set that on the Chromebook only).
|
||||
- Stage 2a (2026-10-23): member/role cache (twilight-cache-inmemory, members requested on GuildCreate), converters (durations, member lookup by name/mention/id/reply), error cards (user errors / 403 / unexpected), permission + role-hierarchy checks, Moderation (kick, ban, unban, timeout, untimeout, nick, role, slowmode), purge (all 15 filters, bulk + one-by-one, Stop button, progress card), help (categories, paged, detail pages, select menu, works after restarts). 18 unit tests incl. a check that every help page fits Discord's V2 limits.
|
||||
- Not yet in 2a: /unban and /timeout autocomplete, `help` autocomplete, bot-permission pre-checks, per-command cooldowns.
|
||||
- Next: stage 2b = logs (audit-log matching, 1174 lines in Python), welcome, role menus, channel tools, dashboard cog.
|
||||
|
||||
## Stage 2b status (2026-10-23)
|
||||
- Done: cdn link refresher, welcome/goodbye/autorole/sticky roles (setup panel with channel + role selects, edit modal, test; join/leave/pending handlers), reqwest HTTPS (tested), 21 unit tests.
|
||||
- Still to do in 2b: logs (audit-log matching), channel tools (lock/media/reddit/nsfw/pin), role menus.
|
||||
|
||||
## Role menus — owner request (keep presets, but configurable in Discord AND on the website)
|
||||
Today: stock categories live in assets/data/role_menus.json (name, emoji, role names); each server only picks which preset
|
||||
names to use (data/role_menus.json: {guild: {cat: {roles:[names], stock:"one"|"many"}, public_messages:{cat:{channel,message}}}}),
|
||||
and only through the Discord editor; the dashboard has no role-menu page.
|
||||
Plan (backward compatible with the existing file):
|
||||
- Presets stay as templates. A server's category may override `name` and `emoji`, edit its `roles` (add/remove/reorder, any
|
||||
name, not just preset ones; missing roles are created with a colour on publish), switch `stock` one/many, and can be a
|
||||
brand-new `custom` category. "Reset to preset" restores the template.
|
||||
- Discord: `/cosmetics` editor gets rename/emoji/add role/remove role/reset, plus "New custom menu".
|
||||
- Website: a Role menus page with the same operations, saving to the same file; the bot re-publishes in place.
|
||||
- Role menus, Discord side DONE (2026-10-23): `/cosmetics` (`D!cosmetics`) overview + editor — rename/emoji, add own roles, tick roles, pick one/many, reset to preset, new/delete custom menus, Publish (creates/deletes roles, posts or edits the dropdown in place); member dropdowns work from the message itself. Reads the existing data/role_menus.json (checked against a copy of the real file). The website page comes with the Rust dashboard (stage 7); the file format above is the shared contract.
|
||||
- Still open in 2b: logs, channel tools (lock/media/reddit/nsfw/pin).
|
||||
|
||||
## Stage 2b — DONE (2026-10-23)
|
||||
- Channel tools: `/lock` `D!lock` `D!unlock` (saved overwrites in the Python bot's own format), `/media`, `/reddit` `D!unreddit`, `/setnsfw` `D!nsfw`, right-click "Pin Message" with a persistent Unpin button (framework now supports message context menus).
|
||||
- Logger: audit-log matching (pushed entries, claims, merged message-delete/voice credits), batched webhook delivery (falls back to the bot), `/logging` setup panel, and handlers for bans, joins (with the invite used), leaves/kicks, AutoMod, pins, prune, message delete/edit/bulk (with transcript), member nick/roles/timeout/boost/screening, voice, channels + permission changes, threads, stages, webhooks, roles, emoji, stickers, server settings, scheduled events. Reads the existing data/logging.json.
|
||||
- Differences from Python worth knowing: other people's username/avatar changes are noticed through member updates (Discord only sends the bot's own user updates); message edit/delete logs need the message to be in the 3000-message cache, as before.
|
||||
- 35 unit tests. Nothing tested against Discord yet.
|
||||
- Next: stage 3 = utility/search/info (userinfo, serverinfo, avatar, weather, wiki, define, calculator, snipe, afk, embed builder…).
|
||||
|
||||
## Stage 3a — DONE (2026-10-23)
|
||||
- Info cards: userinfo, serverinfo, channelinfo, roleinfo, avatar, banner + "Show Avatar"/"Show Banner" right-click apps (framework now has user menus), card colours taken from avatars/icons (`colors.rs`: median-cut palette like the Python version, cached), per-user/server prefs (`prefs.rs`, data/users.json + servers.json), snipe (deleted/edited/reactions, opt-out, paging), afk (+ welcome-back list), mpreg. 47 unit tests.
|
||||
- Still open in stage 3 (3b): tools.py (calculate with keypad, color, translate, weather, viruscheck), search.py (web/image search, wikipedia, define, urban, rule34), embeds.py (/embed builder + "Edit Embed"), and the rest of other.py (dm_echo, /ad, smash, serverclone, owner DMs on join/leave).
|
||||
|
||||
## Stage 3b (tools) — DONE (2026-10-23)
|
||||
- Calculator (own expression parser: big integers, `2^10`, `sin 30`, `5!`, `√16`, old `16 sqrt` style, same error messages; the button keypad keeps its state on the card itself so it survives restarts), colour tool (swatch PNG drawn with the bundled Noto fonts, formats, matches, Lighter/Darker/Complement/Random buttons), translate (`D!tr`, "Translate Message" app, Google + MyMemory fallback), weather (Open-Meteo + ZIP + OpenStreetMap geocoding, autocomplete, °C/°F memory, private "saved place"), VirusTotal (link/file, free-tier limits).
|
||||
- Framework: autocomplete, file-attachment options, replies with a file, private "thinking" answers.
|
||||
- Verified against the live services: Paris / Denver Colorado / Springfield, IL / 10001 / Tokyo geocode and forecast correctly (`cargo test live_weather -- --ignored`). 65 unit tests.
|
||||
- Still open in stage 3 (3c): search.py (web/image search, wikipedia, define, urban, rule34), embeds.py (/embed builder + "Edit Embed"), rest of other.py (dm_echo, /ad, smash, serverclone, owner DMs on join/leave).
|
||||
|
||||
## Stage 3c — DONE (2026-10-23) — stage 3 complete
|
||||
- Search: `/search` + `D!image` (DuckDuckGo html/lite/instant, Bing → Openverse → Zenserp images), Wikipedia (sections, languages, "other matches", random, `fr: Paris`), define (+ pronunciation audio, Urban Dictionary fallback), `D!urban`, rule34 (age-restricted only, same blocklist, TBIB/Xbooru). Generic pager (`pager.rs`) for result pages.
|
||||
- Embed builder (`/embed`, "Edit Embed"): the preview embed is the draft, so editors survive restarts; text/images/author/footer/fields/JSON/import.
|
||||
- `dm_echo`, `/ad` (+ the persistent edit button/form), `smash`/`smashstats`, owner-only `serverclone` (with a confirm prompt: `confirm.rs`), and DMs to server owners when the bot is added/removed.
|
||||
- Framework: cooldowns, owner-only commands.
|
||||
- Verified against the live services: web search, image search, Wikipedia (8 sections, 59 languages), dictionary, Urban Dictionary (`cargo test live_search -- --ignored`). 81 unit tests; 53 commands/menus registered.
|
||||
- Next: stage 4 = media (/download incl. the parallel convert, images/effects, quote, emoji).
|
||||
|
||||
## Stage 4 — DONE (2026-10-23) — media
|
||||
- **Text engine** (`text.rs`, cosmic-text): real shaping + per-character font fallback, so Latin, CJK, Arabic (right-to-left), Indic, Thai, symbols and COLOUR emoji all draw. Fonts ship in `assets/fonts/` (Noto Sans + `fallback/`: CJK, Arabic, Hebrew, Indic scripts, Symbols, Math, Noto Color Emoji ≈ 75 MB with the rest of assets). Google Fonts picked by name are downloaded once (no API key now: the public CSS endpoint) into `data/fonts/google/`.
|
||||
- **Quotes** (`media/quote.rs`): right-click → Create Quote, or reply `D!quote`. Default = the familiar "quote bot" look (greyscale portrait fading into black on the left, centred quote, "- Name", "@handle", small watermark — 1200×630). Presets: Classic, **Portrait** (630×790: picture fading into black, big quote marks, text, divider line, small avatar icon + @handle), and the four older circle styles. On the card: preset, font (any Google Font), layout, flip, B&W/colour, quote marks, name, @handle, divider, icon (off/avatar/server), bold, and a form for size / text colour / background / gradient / watermark. **Save as my default** / **Save for this server** (Manage Server) / Reset. The watermark defaults to "Dezio" (editable, empty = none).
|
||||
- Shared file for the dashboard: `data/quote.json` = `{"users": {"<id>": Style}, "servers": {"<id>": Style}}`; every `Style` key has a default, so partial objects are fine. Keys: preset, layout (wide|portrait), image (fade|circle|none), grayscale, flip, bg, bg2 (gradient end or null), text, author, muted, font, bold, size (0 = fit), marks, name, handle, line, icon (none|avatar|server), watermark, quote_chars. Resolution order: your style → server style → Classic.
|
||||
- **Image effects** (`media/images.rs`): `/image` (`D!fx`): all 10 effects and 14 filters, GIFs/animated WebP keep their animation, size-aware re-render for the upload limit. NEW `convert` option (also `/convert` and `D!convert <format>`): picture/GIF/video → gif, mp4, webm, png, jpg, webp or mp3 (ffmpeg; retries smaller settings until it fits; a still picture becomes a 3 s clip). Sources: attachment, replied message (attachments, embed video/image, stickers), link, custom emoji, @user avatar. `/petpet` + `D!petpet`.
|
||||
- **Emoji** (`media/emoji.rs`): `/steal`, `/combine` (Emoji Kitchen), `D!emoji` browser and the Get Assets menu with "Add to this server".
|
||||
- **/download** (`media/download/`): the whole Python pipeline ported (yt-dlp + ffmpeg + gallery-dl as child processes): sizes checked before downloading (CDN asked when yt-dlp doesn't know), H.264+AAC preferred, size watchdog that drops to a smaller stream, **VP9/AV1/HEVC converted while downloading** (one ffmpeg reads yt-dlp's stream URLs directly; falls back to download-then-convert), ffprobe validation, one-pass compression, slideshows/carousels via gallery-dl, audio mode (Opus 96 kbps), progress card with Cancel, Delete + Original post buttons, upload retries, one job at a time. Verified against a local server (H.264, VP9, convert-while-downloading, audio, forced squeeze, cancel) and real links (a direct mp4 and a YouTube video).
|
||||
- Framework: `Command::slash_as` (a slash name different from the text command: `/image` = `D!fx`), `find_slash`.
|
||||
- Not tested against Discord. Known gaps: no per-command "I need Attach Files" pre-check; the quote card's controls stop working after a restart (sessions live in memory, as the Python view did).
|
||||
- Next: stage 5 = fun / AI / games / casino.
|
||||
|
||||
## Stage 6 — DONE (2026-10-23) — music + Last.fm
|
||||
- **Music** (`commands/music/`): songbird (with Discord's required voice encryption) for voice; yt-dlp lookups in separate processes; ffmpeg → PCM read ahead in a 15 s buffer (a stall plays silence instead of rushing; position counts real frames only). `/play` (search or link, playlists, YouTube mixes load 25 first then the rest), `/pause` `/resume` `/skip` `/stop` `/queue` `/nowplaying` `/seek` `/loop` `/shuffle` `/unqueue` `/volume` `/join` `/leave` + `D!mhelp`, aliases as before. Now-playing panel with buttons that carry `music:<action>:<guild>` (work after restarts), card colour from the cover, bitrate = channel bitrate (≤96 kbps), idle leave after 5 min, prefetch of the next stream, volume saved per server.
|
||||
- **Last.fm** (`commands/lastfm/`): `/fm` (now playing, top, recent, profile, link), `D!ta/tab/tt/recent/fmprofile/fmset`, Who Knows (`D!wk/wkt/wka`, prefix only), `D!chart` collage (prefix only) (drawn with the new text engine), Pixel Jumble (`D!px`, prefix only: a linked member starts a round from their own albums, then anyone can answer by typing in chat or with the button), `/lyrics` (LRCLIB + lyrics.ovh), "Listen to song" button (yt-dlp → Opus file, private, deletes itself). Cards use the games engine (owner-only buttons, switch views, idle end). Reads data/lastfm.json.
|
||||
- Verified live: Last.fm API (profile, top artists, not-found, album info); YouTube search → stream → ffmpeg → 204 real audio frames. NOT verified: actually joining a voice channel (needs Discord).
|
||||
- Known gap: on a stage channel the bot asks to speak but can't auto-unsuppress (twilight's builder has no "suppress: false").
|
||||
- Next: stage 7 = dashboard (+ role-menu page, quote styles page), Game Boy Activity server, TUI.
|
||||
|
||||
## Stage 7 — DONE (2026-10-23) — dashboard, Game Boy Activity, console
|
||||
- **Dashboard** (`src/web/`, axum): the website, `/dashboard` (the same pages as before, extended), Discord sign-in (OAuth, sessions in data/dashboard_sessions.json — same format as Python, so people stay signed in), CSRF + same-origin checks, live Manage Server checks from the member cache. API: `/api/me`, `/api/user` (Last.fm link, AFK, download quality, weather, privacy, **quote style**), `/api/guilds/<id>` (prefix, music volume, snipe, logging channels, welcome/goodbye + autoroles, AI personality/lock, **server quote style**, **role menus**), `/api/places`, `/api/quote/preview` (the bot draws the preview, so it's exactly what Create Quote makes). `DASHBOARD_URL`, `DASHBOARD_CLIENT_SECRET`, `DASHBOARD_HOST/PORT` as before.
|
||||
- New pages: **Quote style** (preset, layout, picture mode, toggles, icon, any Google Font, size, colours, gradient, watermark, live preview; saved as the person's default or the server's default → data/quote.json) and **Role menus** (edit presets, add roles, one/many, reset to preset, new custom menus, publish to a channel — the same data and publish code as `/cosmetics`).
|
||||
- **Game Boy Activity** (`src/web/activity.rs`, `commands/gameboy.rs`): the same API as the Python server (config, token, web-session, library with covers from SteamGridDB, ROM download, battery saves, save states, legacy saves); `/gameboy` launches the Activity (raw interaction callback type 12), `D!gameboy` posts a Play card; slash sync keeps Discord's "Launch" entry-point command.
|
||||
- **Console** (`src/tui.rs`, ratatui): live stats header, Activity / Console / Commands / Servers tabs, command box (`help`, `sync`, `status <text|reset>`, `send <channel> <text>`, `servers`, `leave <id>`, `clear`, `quit`). Starts when the bot runs in a terminal; `--headless` or no terminal (systemd) logs as plain text. Not ported: cog reload/load/unload (nothing to reload in a binary) and the Python self-test tab (the Rust tests replace it).
|
||||
- **Status**: "Watching In N servers | /help | D!help" (+ owner `setstatus` / `resetstat`).
|
||||
- `--web-dev` serves only the web pages with a made-up signed-in session (cookie `dezio_session=devtoken`, http://127.0.0.1:8099) for looking at the dashboard without Discord. Checked in the browser: the quote editor draws wide and portrait previews (Latin/Japanese/Arabic/emoji) and saves.
|
||||
- 7 web tests (pages + security headers, sign-in gate, CSRF/origin refusals, settings saved and validated, quote preview PNG, ROM library + saves per player).
|
||||
- Not tested: the server-settings endpoints (they need a live server cache), OAuth against Discord, the Activity inside Discord.
|
||||
- Note: ~/Projects/Dezio/data/ holds leftovers from the unit tests (fake ids); it's git-ignored and gets replaced by the real Python data in stage 8.
|
||||
- Next: stage 8 = run against the real data/*.json from the Python bot, a final comparison of every command, then deploy + the Chromebook boot service.
|
||||
|
||||
## Stage 8 — IN PROGRESS (2026-10-23) — parity check
|
||||
- Data: compared every file in the Python `data/` with what the Rust code reads (afk, ads, ai, casino, channels, confessions, cookieclicker, lastfm, logging, prefixes, reaction_roles, role_menus, snipes, status_roles, sticky_roles, temp_roles, welcome): same names and shapes, so the Python files can be copied over as they are. `users.json` / `servers.json` don't exist in Python's data yet (created on first use).
|
||||
- Command comparison (every Python command, alias and slash name vs the Rust registry) found one gap: **reaction roles, temporary roles and status roles** (`roles.py`). Now ported in `src/commands/reactionroles.rs`: `D!rr add|remove|list|<mode> [minutes]`, `/reactionrole`, `/rr-type`, `/rep` (+ `D!rep`), the reaction add/remove handler (normal, toggle, unique, verify, temporary), a 30 s expiry loop, and status-role sync on presence changes, joins and `/rep` changes. Uses the real data (4 reaction-role messages, one `/hurtme` status role).
|
||||
- Not ported on purpose: the owner-only `D!dashboard` (the web server starts by itself), `D!selftest` (Rust tests replace it).
|
||||
- Still to do: deploy to the Chromebook and fix its start-at-boot service (needs the owner's go-ahead because it replaces the running Python bot); Python files stay until the owner says to delete them.
|
||||
|
||||
## Stage 8 — DONE (2026-10-23) — deployed
|
||||
- Chromebook (192.168.1.71): Rust bot in `/root/Dezio` (binary, assets, web, copy of Python's data + .env). `dezio-bot.service` now runs `/root/Dezio/dezio --headless` (DEZIO_LIVE=1), enabled at boot, Restart=always; the health-check timer still checks :8080. Python bot stopped (its files in `/root/Discord Bot` untouched).
|
||||
- Backups: `/root/dezio-bot.service.bak` (old unit), `/root/dezio-python-data-*-pre-switch.tar.gz`, `/root/dezio-python-2026-10-23-pre-rust.tar.gz`.
|
||||
- Rollback: `systemctl stop dezio-bot; cp /root/dezio-bot.service.bak /etc/systemd/system/dezio-bot.service; systemctl daemon-reload; systemctl start dezio-bot`.
|
||||
- Fix found on first start: slash descriptions over 100 characters made Discord refuse the whole sync; they're now cut to 100.
|
||||
- Source: forgejo:astar76/Dezio.git (branch master).
|
||||
2
assets/fonts/LICENSE.txt
Normal file
2
assets/fonts/LICENSE.txt
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
Noto Sans and the fonts in google/ are licensed under the SIL Open Font License 1.1
|
||||
(https://openfontlicense.org). They are bundled so image commands look the same on every host.
|
||||
BIN
assets/fonts/NotoSans-Bold.ttf
Normal file
BIN
assets/fonts/NotoSans-Bold.ttf
Normal file
Binary file not shown.
BIN
assets/fonts/NotoSans-Regular.ttf
Normal file
BIN
assets/fonts/NotoSans-Regular.ttf
Normal file
Binary file not shown.
BIN
assets/fonts/fallback/NotoColorEmoji.ttf
Normal file
BIN
assets/fonts/fallback/NotoColorEmoji.ttf
Normal file
Binary file not shown.
BIN
assets/fonts/fallback/NotoSansArabic-Regular.ttf
Normal file
BIN
assets/fonts/fallback/NotoSansArabic-Regular.ttf
Normal file
Binary file not shown.
BIN
assets/fonts/fallback/NotoSansArmenian-Regular.ttf
Normal file
BIN
assets/fonts/fallback/NotoSansArmenian-Regular.ttf
Normal file
Binary file not shown.
BIN
assets/fonts/fallback/NotoSansBengali-Regular.ttf
Normal file
BIN
assets/fonts/fallback/NotoSansBengali-Regular.ttf
Normal file
Binary file not shown.
BIN
assets/fonts/fallback/NotoSansCJK-Bold.ttc
Normal file
BIN
assets/fonts/fallback/NotoSansCJK-Bold.ttc
Normal file
Binary file not shown.
BIN
assets/fonts/fallback/NotoSansCJK-Regular.ttc
Normal file
BIN
assets/fonts/fallback/NotoSansCJK-Regular.ttc
Normal file
Binary file not shown.
BIN
assets/fonts/fallback/NotoSansDevanagari-Regular.ttf
Normal file
BIN
assets/fonts/fallback/NotoSansDevanagari-Regular.ttf
Normal file
Binary file not shown.
BIN
assets/fonts/fallback/NotoSansEthiopic-Regular.ttf
Normal file
BIN
assets/fonts/fallback/NotoSansEthiopic-Regular.ttf
Normal file
Binary file not shown.
BIN
assets/fonts/fallback/NotoSansGeorgian-Regular.ttf
Normal file
BIN
assets/fonts/fallback/NotoSansGeorgian-Regular.ttf
Normal file
Binary file not shown.
BIN
assets/fonts/fallback/NotoSansGujarati-Regular.ttf
Normal file
BIN
assets/fonts/fallback/NotoSansGujarati-Regular.ttf
Normal file
Binary file not shown.
BIN
assets/fonts/fallback/NotoSansGurmukhi-Regular.ttf
Normal file
BIN
assets/fonts/fallback/NotoSansGurmukhi-Regular.ttf
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue