Files
derp/docs/CHEATSHEET.md
user bf45abcbad 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
2026-02-15 00:37:31 +01:00

1.3 KiB

Cheatsheet

Quick Commands

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

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