# Usage Guide ## Running ```bash # From project directory derp # With options derp --config /path/to/derp.toml --verbose ``` ## CLI Flags | Flag | Description | |------|-------------| | `-c, --config PATH` | Config file path | | `-v, --verbose` | Debug logging | | `--cprofile [PATH]` | Enable cProfile, dump to PATH [derp.prof] | | `--tracemalloc [N]` | Enable tracemalloc, capture N frames deep [10] | | `-V, --version` | Print version | | `-h, --help` | Show help | ## Configuration All settings in `config/derp.toml`. ### Single-Server (Legacy) ```toml [server] host = "irc.libera.chat" # IRC server hostname port = 6697 # Port (6697 = TLS, 6667 = plain) tls = true # Enable TLS encryption proxy = false # Route through SOCKS5 proxy (default: false) nick = "derp" # Bot nickname user = "derp" # Username (ident) realname = "derp IRC bot" # Real name field password = "" # Server password (optional) sasl_user = "" # SASL PLAIN username (optional) sasl_pass = "" # SASL PLAIN password (optional) ircv3_caps = [ # IRCv3 capabilities to request "multi-prefix", "away-notify", "server-time", "cap-notify", "account-notify", ] [bot] prefix = "!" # Command prefix character channels = ["#test"] # Channels to join on connect plugins_dir = "plugins" # Plugin directory path rate_limit = 2.0 # Max messages per second (default: 2.0) rate_burst = 5 # Burst capacity (default: 5) paste_threshold = 4 # Max lines before overflow to FlaskPaste (default: 4) admins = [] # Hostmask patterns (fnmatch), IRCOPs auto-detected timezone = "UTC" # Timezone for calendar reminders (IANA tz name) operators = [] # Hostmask patterns for "oper" tier (fnmatch) trusted = [] # Hostmask patterns for "trusted" tier (fnmatch) [logging] level = "info" # Logging level: debug, info, warning, error format = "text" # Log format: "text" (default) or "json" [webhook] enabled = false # Enable HTTP webhook listener host = "127.0.0.1" # Bind address port = 8080 # Bind port secret = "" # HMAC-SHA256 shared secret (empty = no auth) ``` ### Multi-Server Connect to multiple IRC servers from a single config. Plugins are loaded once and shared; state is isolated per server (`data/state-.db`). ```toml [bot] prefix = "!" # Shared defaults for all servers plugins_dir = "plugins" admins = ["*!~root@*.ops.net"] [servers.libera] host = "irc.libera.chat" port = 6697 tls = true nick = "derp" channels = ["#test", "#ops"] [servers.oftc] host = "irc.oftc.net" port = 6697 tls = true nick = "derpbot" channels = ["#derp"] admins = ["*!~admin@oftc.host"] # Override shared admins [logging] level = "info" format = "json" [webhook] enabled = true port = 8080 secret = "shared-secret" ``` Each `[servers.]` block may contain both server-level keys (host, port, tls, nick, etc.) and bot-level overrides (prefix, channels, admins, operators, trusted, rate_limit, rate_burst, paste_threshold). Unset keys inherit from the shared `[bot]` and `[server]` defaults. The server name (e.g. `libera`, `oftc`) is used for: - Log prefixes and `!version` output - State DB path (`data/state-libera.db`) - Plugin runtime state isolation Existing single-server configs (`[server]` section) continue to work unchanged. The server name is derived from the hostname automatically. ## Built-in Commands | Command | Description | |---------|-------------| | `!ping` | Bot responds with "pong" | | `!help` | List all commands + paste full reference | | `!help ` | Show help + paste detailed docstring | | `!help ` | Show plugin description + paste command details | | `!version` | Show bot version | | `!uptime` | Show how long the bot has been running | | `!echo ` | Echo back text (example plugin) | | `!cert [...]` | Lookup CT logs for up to 5 domains | | `!whoami` | Show your hostmask and admin status | | `!load ` | Hot-load a plugin (admin) | | `!reload ` | Reload a plugin (admin) | | `!unload ` | Unload a plugin (admin) | | `!admins` | Show admin patterns and detected opers (admin) | | `!plugins` | List loaded plugins with handler counts | | `!state [key]` | Inspect plugin state store (admin) | | `!kick [reason]` | Kick user from channel (admin) | | `!ban ` | Ban a hostmask in channel (admin) | | `!unban ` | Remove a ban from channel (admin) | | `!topic [text]` | Set or query channel topic (admin) | | `!mode [args]` | Set channel mode (admin) | | `!dns [type]` | DNS lookup (A, AAAA, MX, NS, TXT, CNAME, PTR, SOA) | | `!tdns [type] [@server]` | TCP DNS lookup via SOCKS5 proxy | | `!encode ` | Encode text (b64, hex, url, rot13) | | `!decode ` | Decode text (b64, hex, url, rot13) | | `!hash [algo] ` | Generate hash digests (md5, sha1, sha256, sha512) | | `!hashid ` | Identify hash type by format | | `!defang ` | Defang URLs/IPs/domains for safe sharing | | `!refang ` | Restore defanged IOCs | | `!revshell ` | Generate reverse shell one-liner | | `!cidr ` | Subnet info (range, hosts, mask) | | `!cidr contains ` | Check if IP belongs to network | | `!whois ` | WHOIS lookup via raw TCP (port 43) | | `!portcheck [ports]` | Async TCP port scan (max 20 ports) | | `!httpcheck ` | HTTP status, redirects, response time | | `!tlscheck [port]` | TLS version, cipher, cert details | | `!blacklist ` | Check IP against 10 DNSBLs | | `!rand [args]` | Random: password, hex, uuid, bytes, int, coin, dice | | `!timer [label]` | Set countdown timer with notification | | `!timer list` | Show active timers | | `!timer cancel