2.5 KiB
2.5 KiB
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 stdlibsslon 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.treesdefaults, so the common case needs zero config. Secrets (NickServ pass) live in gitignoredconfig.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
!delquoteshould be restricted to ops/admins (currently anyone can delete). Fine for a trusted channel; revisit if abused.
Resolved
#r.treesis+r(registered-nicks-only). Nicktreesquotesis registered & NickServ-verified under megaproxy@gmail.com. Password lives in gitignoredconfig.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),QuoteStoreSQLite wrapper, and!command handlers. - Added
README.md,config.example.env; gitignoredquotes.db/config.env. - Syntax-checked with
py_compile(Python 3.12.3). - Live-tested against Libera: discovered
#r.treesis+r. Registered/verified thetreesquotesnick. Fixed a join race — bot was sending JOIN before the NickServ login landed and getting bounced (477); now defers JOIN until the900/"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-memorylast_linesbuffer (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