Initial quotebot: stdlib IRC quotes bot for Libera #r.trees
This commit is contained in:
commit
841a152436
6 changed files with 530 additions and 0 deletions
53
README.md
Normal file
53
README.md
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
# quotebot
|
||||
|
||||
A simple quotes IRC bot for [Libera.Chat](https://libera.chat). Standard-library
|
||||
Python only — no pip install, no virtualenv. Connects over TLS, joins a channel,
|
||||
and serves quotes from a local SQLite database via `!` commands.
|
||||
|
||||
## Run it
|
||||
|
||||
```bash
|
||||
python3 bot.py
|
||||
```
|
||||
|
||||
That connects to `irc.libera.chat:6697` as `treesquotes` and joins `#r.trees`.
|
||||
|
||||
To override anything, copy the example config and source it first:
|
||||
|
||||
```bash
|
||||
cp config.example.env config.env # config.env is gitignored
|
||||
# edit config.env as needed
|
||||
set -a; source config.env; set +a
|
||||
python3 bot.py
|
||||
```
|
||||
|
||||
## Commands (in-channel)
|
||||
|
||||
| Command | Does |
|
||||
|--------------------|-------------------------------------------|
|
||||
| `!quote` | Random quote |
|
||||
| `!quote <id>` | Quote by number |
|
||||
| `!addquote <text>` | Store a new quote, returns its id |
|
||||
| `!delquote <id>` | Delete a quote |
|
||||
| `!search <term>` | First quote containing a substring |
|
||||
| `!quotecount` | How many quotes are stored |
|
||||
| `!help` | List commands |
|
||||
|
||||
## Notes
|
||||
|
||||
- Quotes live in `quotes.db` (SQLite, created on first run, gitignored).
|
||||
- The bot auto-reconnects with exponential backoff and answers `PING`.
|
||||
- If the nick is taken it appends `_` and retries.
|
||||
- A NickServ password, if set via `IRC_NICKSERV_PASS`, is sent on connect —
|
||||
keep it in the environment, never in the repo.
|
||||
- Outbound messages are spaced by `QUOTEBOT_SEND_DELAY` seconds to avoid
|
||||
tripping Libera's flood limits.
|
||||
|
||||
## Registering the nick (recommended)
|
||||
|
||||
Libera lets unregistered bots connect, but channels can be set to block
|
||||
unregistered users. To register `treesquotes`:
|
||||
|
||||
1. Connect once, then `/msg NickServ REGISTER <password> <email>`.
|
||||
2. Confirm via the emailed code.
|
||||
3. Put the password in `config.env` as `IRC_NICKSERV_PASS` and restart.
|
||||
Loading…
Add table
Add a link
Reference in a new issue