Files
derp/docs/CHEATSHEET.md
user 77f9a364e6 feat: add hot-reload, shorthand commands, and plugin help
- Plugin registry: add unload_plugin(), reload_plugin(), path tracking
- Bot: add load_plugin(), reload_plugin(), unload_plugin() public API
- Core plugin: add !load, !reload, !unload, !plugins commands
- Command dispatch: support unambiguous prefix matching (!h -> !help)
- Help: support !help <plugin> to show plugin description and commands
- Tests: 17 new tests covering hot-reload, prefix matching

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 01:15:59 +01:00

1.6 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
!help <plugin>     # Plugin description + commands
!version           # Bot version
!echo <text>       # Echo text back
!cert <domain>     # CT log lookup (max 5 domains)
!load <plugin>     # Hot-load a plugin
!reload <plugin>   # Reload a changed plugin
!unload <plugin>   # Remove a plugin
!plugins           # List loaded plugins
!h                 # Shorthand (any unambiguous prefix works)

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