docs: update docs for Mumble integration
Add Mumble sections to USAGE.md, CHEATSHEET.md, API.md, README.md. Mark Mumble done in ROADMAP.md and TODO.md. Update TASKS.md sprint.
This commit is contained in:
81
docs/API.md
81
docs/API.md
@@ -357,6 +357,87 @@ Same stable attributes and methods as `Bot`:
|
||||
|
||||
---
|
||||
|
||||
## `derp.mumble` -- Mumble Adapter
|
||||
|
||||
Alternative bot adapter for Mumble via TCP/TLS protobuf control channel
|
||||
(text chat only). All TCP routed through SOCKS5 proxy. Uses a minimal
|
||||
built-in protobuf encoder/decoder (no external dependency). Exposes the
|
||||
same plugin API as `derp.bot.Bot`.
|
||||
|
||||
### `MumbleMessage` dataclass
|
||||
|
||||
Duck-typed compatible with IRC `Message`:
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `raw` | `dict` | Decoded protobuf fields |
|
||||
| `nick` | `str \| None` | Sender username (from session lookup) |
|
||||
| `prefix` | `str \| None` | Sender username (for ACL) |
|
||||
| `text` | `str \| None` | Message body (HTML stripped) |
|
||||
| `target` | `str \| None` | channel_id as string (or `"dm"`) |
|
||||
| `is_channel` | `bool` | `True` for channel msgs, `False` for DMs |
|
||||
| `command` | `str` | Always `"PRIVMSG"` (compat shim) |
|
||||
| `params` | `list[str]` | `[target, text]` |
|
||||
| `tags` | `dict[str, str]` | Empty dict (no IRCv3 tags) |
|
||||
|
||||
### `MumbleBot`
|
||||
|
||||
Same stable attributes and methods as `Bot`:
|
||||
|
||||
| Attribute | Type | Description |
|
||||
|-----------|------|-------------|
|
||||
| `name` | `str` | Always `"mumble"` |
|
||||
| `config` | `dict` | Merged TOML configuration |
|
||||
| `nick` | `str` | Bot username (from config) |
|
||||
| `prefix` | `str` | Command prefix (from `[mumble]` or `[bot]`) |
|
||||
| `state` | `StateStore` | Persistent key-value storage |
|
||||
| `registry` | `PluginRegistry` | Shared command and event registry |
|
||||
|
||||
**Sending messages** -- same signatures, Mumble protobuf transport:
|
||||
|
||||
| Method | Behaviour |
|
||||
|--------|-----------|
|
||||
| `send(target, text)` | TextMessage to channel (HTML-escaped) |
|
||||
| `reply(msg, text)` | `send(msg.target, text)` |
|
||||
| `long_reply(msg, lines, *, label="")` | Paste overflow, same logic as IRC |
|
||||
| `action(target, text)` | Italic HTML text (`<i>...</i>`) |
|
||||
| `shorten_url(url)` | Same FlaskPaste integration |
|
||||
|
||||
**IRC no-ops** (debug log, no error):
|
||||
|
||||
`join`, `part`, `kick`, `mode`, `set_topic`
|
||||
|
||||
**Plugin management** -- delegates to shared registry:
|
||||
|
||||
`load_plugins`, `load_plugin`, `reload_plugin`, `unload_plugin`
|
||||
|
||||
**Permission tiers** -- same model, exact username string matching:
|
||||
|
||||
`_get_tier(msg)`, `_is_admin(msg)`
|
||||
|
||||
### Protobuf Codec (internal)
|
||||
|
||||
Minimal protobuf wire format helpers -- not part of the stable API:
|
||||
|
||||
| Function | Description |
|
||||
|----------|-------------|
|
||||
| `_encode_varint(value)` | Encode unsigned int as protobuf varint |
|
||||
| `_decode_varint(data, offset)` | Decode varint, returns `(value, offset)` |
|
||||
| `_encode_field(num, wire_type, value)` | Encode a single protobuf field |
|
||||
| `_decode_fields(data)` | Decode payload into `{field_num: [values]}` |
|
||||
| `_pack_msg(msg_type, payload)` | Wrap payload in 6-byte Mumble header |
|
||||
| `_unpack_header(data)` | Unpack header into `(msg_type, length)` |
|
||||
|
||||
### Helper Functions
|
||||
|
||||
| Function | Signature | Description |
|
||||
|----------|-----------|-------------|
|
||||
| `_strip_html` | `(text: str) -> str` | Strip HTML tags and unescape entities |
|
||||
| `_escape_html` | `(text: str) -> str` | Escape text for Mumble HTML messages |
|
||||
| `_build_mumble_message` | `(fields, users, our_session) -> MumbleMessage \| None` | Build message from decoded TextMessage fields |
|
||||
|
||||
---
|
||||
|
||||
## Handler Signatures
|
||||
|
||||
All command and event handlers are async functions receiving `bot` and
|
||||
|
||||
Reference in New Issue
Block a user