53 lines
2.5 KiB
Markdown
53 lines
2.5 KiB
Markdown
# 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
|
|
|
|
- [ ] Exercise the `!` commands live in-channel (connect + join verified; command
|
|
round-trip not yet tested with a second client).
|
|
- [ ] Decide whether `!delquote` should be restricted to ops/admins (currently
|
|
anyone can delete). Fine for a trusted channel; revisit if abused.
|
|
|
|
## Resolved
|
|
|
|
- `#r.trees` is `+r` (registered-nicks-only). Nick `treesquotes` is registered &
|
|
NickServ-verified under megaproxy@gmail.com. Password lives in gitignored
|
|
`config.env` (`IRC_NICKSERV_PASS`). Bot identifies and joins successfully.
|
|
|
|
## 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).
|
|
- Live-tested against Libera: discovered `#r.trees` is `+r`. Registered/verified
|
|
the `treesquotes` nick. Fixed a join race — bot was sending JOIN before the
|
|
NickServ login landed and getting bounced (477); now defers JOIN until the
|
|
`900`/"now identified" confirmation. Verified join succeeds (got 353/366).
|
|
|
|
### 2026-06-04 (cont.)
|
|
- Added `!grabquote [user]` (alias `!grab`): stores the last line a user said,
|
|
formatted `<nick> message`. Backed by an in-memory `last_lines` buffer
|
|
(per-session, resets on reconnect); bot commands are excluded from it. No-arg
|
|
form grabs the last real speaker. Offline-tested.
|
|
|
|
## External references
|
|
|
|
- Libera.Chat: <https://libera.chat> — server `irc.libera.chat:6697` (TLS).
|
|
- NickServ registration docs: <https://libera.chat/guides/registration>
|