feat: initial implementation
Asyncio IRC bot with decorator-based plugin system. Zero external dependencies, Python 3.11+. - IRC protocol: message parsing, formatting, async TCP/TLS connection - Plugin system: @command and @event decorators, file-based loading - Bot orchestrator: connect, dispatch, reconnect, nick recovery - CLI: argparse entry point with TOML config - Built-in plugins: ping, help, version, echo - 28 unit tests for parser and plugin system
This commit is contained in:
59
docs/CHEATSHEET.md
Normal file
59
docs/CHEATSHEET.md
Normal file
@@ -0,0 +1,59 @@
|
||||
# Cheatsheet
|
||||
|
||||
## Quick Commands
|
||||
|
||||
```bash
|
||||
make install # Setup venv + install
|
||||
make test # Run tests
|
||||
make lint # Lint with ruff
|
||||
make run # Start bot
|
||||
make link # Symlink to ~/.local/bin
|
||||
derp -c config.toml # Run with custom config
|
||||
derp -v # Verbose/debug mode
|
||||
```
|
||||
|
||||
## Bot Commands
|
||||
|
||||
```
|
||||
!ping # Pong
|
||||
!help # List commands
|
||||
!help <cmd> # Command help
|
||||
!version # Bot version
|
||||
!echo <text> # Echo text back
|
||||
```
|
||||
|
||||
## Plugin Template
|
||||
|
||||
```python
|
||||
from derp.plugin import command, event
|
||||
|
||||
@command("name", help="Description")
|
||||
async def cmd_name(bot, message):
|
||||
text = message.text.split(None, 1)
|
||||
await bot.reply(message, "response")
|
||||
|
||||
@event("JOIN")
|
||||
async def on_join(bot, message):
|
||||
await bot.send(message.target, f"Hi {message.nick}")
|
||||
```
|
||||
|
||||
## Message Object
|
||||
|
||||
```
|
||||
msg.nick # Sender nick
|
||||
msg.target # Channel or nick
|
||||
msg.text # Message body
|
||||
msg.is_channel # True if channel
|
||||
msg.prefix # nick!user@host
|
||||
msg.command # PRIVMSG, JOIN, etc.
|
||||
msg.params # All params list
|
||||
```
|
||||
|
||||
## Config Locations
|
||||
|
||||
```
|
||||
1. --config PATH # CLI flag
|
||||
2. ./config/derp.toml # Project dir
|
||||
3. ~/.config/derp/derp.toml # User config
|
||||
4. Built-in defaults # Fallback
|
||||
```
|
||||
Reference in New Issue
Block a user