Initial quotebot: stdlib IRC quotes bot for Libera #r.trees

This commit is contained in:
megaproxy 2026-06-04 17:13:56 +01:00
commit 841a152436
6 changed files with 530 additions and 0 deletions

38
memory.md Normal file
View file

@ -0,0 +1,38 @@
# memory — quotebot
Durable memory for this project. Read at session start, update before session end. Date format: `YYYY-MM-DD`.
## Decisions & rationale
- **Python stdlib only, raw-socket IRC.** User asked for a *simple* bot; no
third-party libs means it runs anywhere with `python3 bot.py`, no venv/pip.
TLS via stdlib `ssl` on Libera's port 6697.
- **SQLite for quotes** (`quotes.db`), managed entirely with in-channel `!`
commands (`!addquote`/`!quote`/`!delquote`/`!search`/`!quotecount`). Chosen
over a JSON file for safe concurrent-ish access and easy querying.
- **Config via env vars** with Libera + `#r.trees` defaults, so the common case
needs zero config. Secrets (NickServ pass) live in gitignored `config.env`.
- **Resilience:** auto-reconnect with exponential backoff, PING/PONG, nick-in-use
fallback (append `_`). Outbound send delay to dodge flood limits.
## Open questions / TODOs
- [ ] Live-test against Libera (join `#r.trees`, exercise commands). Not yet run.
- [ ] Decide whether `!delquote` should be restricted to ops/admins (currently
anyone can delete). Fine for a trusted channel; revisit if abused.
- [ ] Consider registering the `treesquotes` nick with NickServ if the channel
blocks unregistered users.
## Session log
### 2026-06-04
- Created project scaffold from template.
- Wrote `bot.py`: stdlib IRC client (TLS, PING/PONG, reconnect, nick fallback),
`QuoteStore` SQLite wrapper, and `!` command handlers.
- Added `README.md`, `config.example.env`; gitignored `quotes.db`/`config.env`.
- Syntax-checked with `py_compile` (Python 3.12.3). Not yet live-tested on IRC.
## External references
- Libera.Chat: <https://libera.chat> — server `irc.libera.chat:6697` (TLS).
- NickServ registration docs: <https://libera.chat/guides/registration>