Skip to content

Commit 8f3fae0

Browse files
DevRohit06claude
andcommitted
docs: comprehensive update for all new features + Node 22
Workflow: - Update docs.yml to Node 22 Reference (4 files): - cli-commands: add rich embeds, bulk-delete, channel edit/forum/permissions, thread management, member timeout, role edit, reaction users, poll results/end, webhooks, events - serve-actions: add 20+ new actions, embeds/components on send/reply, interaction_respond/edit, modal_send, webhooks, events - serve-events: add voice_state, component_interaction, modal_submit, disconnected, resumed - permission-profiles: add new destructive commands, moderate_members Guides (5 files): - cli-usage: examples for all new commands - serve-mode: embeds, components, modals, voice, new actions (54 total) - building-agents: AI serve agent architecture and patterns - slash-commands: interaction_respond/edit with embeds/components - security-permissions: new destructive commands New guide: - components-modals: buttons, selects, modals, interaction handling Use cases & other (5 files): - ai-support-agent: rewritten for ai_serve_agent.py - serve-protocol: all new events and actions - faq: embeds/buttons now fully supported - edge-cases: validation fixes documented - docs-config: new sidebar entries Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4ead846 commit 8f3fae0

16 files changed

Lines changed: 1716 additions & 178 deletions

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424

2525
- uses: actions/setup-node@v4
2626
with:
27-
node-version: 20
27+
node-version: 22
2828

2929
- name: Build docs with Lito
3030
run: npx @litodocs/cli build -i ./docs -o ./docs/dist

docs/architecture/serve-protocol.mdx

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,21 @@ Events are emitted by discli as things happen on Discord. Every event object has
6464
| Event | Fields | Description |
6565
|---|---|---|
6666
| `slash_command` | `command`, `args`, `user`, `user_id`, `channel_id`, `guild_id`, `interaction_token`, `is_admin` | Slash command invoked by a user |
67+
| `component_interaction` | `custom_id`, `component_type`, `values`, `user`, `user_id`, `channel_id`, `message_id`, `interaction_token` | Button click or select menu choice |
68+
| `modal_submit` | `custom_id`, `fields`, `user`, `user_id`, `channel_id`, `interaction_token` | Modal form submitted by a user |
69+
70+
### Voice events
71+
72+
| Event | Fields | Description |
73+
|---|---|---|
74+
| `voice_state` | `user`, `user_id`, `channel`, `channel_id`, `old_channel`, `old_channel_id`, `guild_id`, `self_mute`, `self_deaf` | User joined, left, or moved voice channels |
75+
76+
### Connection events
77+
78+
| Event | Fields | Description |
79+
|---|---|---|
80+
| `disconnected` | `code`, `reason` | Bot disconnected from Discord gateway |
81+
| `resumed` | -- | Bot reconnected and resumed the session |
6782

6883
### Reaction events
6984

@@ -150,9 +165,9 @@ Actions are JSON objects sent to discli via stdin. Every action must have an `"a
150165

151166
| Action | Required Fields | Optional Fields | Description |
152167
|---|---|---|---|
153-
| `send` | `channel_id`, `content` | `files`, `req_id` | Send a message to a channel |
154-
| `reply` | `channel_id`, `message_id`, `content` | `files`, `req_id` | Reply to a specific message |
155-
| `edit` | `channel_id`, `message_id`, `content` | `req_id` | Edit a bot message |
168+
| `send` | `channel_id`, `content` | `embed`, `components`, `files`, `req_id` | Send a message to a channel |
169+
| `reply` | `channel_id`, `message_id`, `content` | `embed`, `components`, `files`, `req_id` | Reply to a specific message |
170+
| `edit` | `channel_id`, `message_id`, `content` | `embed`, `components`, `req_id` | Edit a bot message |
156171
| `delete` | `channel_id`, `message_id` | `req_id` | Delete a message |
157172

158173
### Streaming
@@ -191,7 +206,10 @@ Streaming lets you progressively update a single message, similar to how ChatGPT
191206

192207
| Action | Required Fields | Optional Fields | Description |
193208
|---|---|---|---|
194-
| `interaction_followup` | `interaction_token`, `content` | `req_id` | Send a follow-up response to a slash command |
209+
| `interaction_respond` | `interaction_token`, `content` | `embed`, `components`, `ephemeral`, `req_id` | Immediate response to a component interaction |
210+
| `interaction_edit` | `interaction_token` | `content`, `embed`, `components`, `req_id` | Edit the original interaction message |
211+
| `interaction_followup` | `interaction_token`, `content` | `embed`, `components`, `req_id` | Send a follow-up response to a slash command |
212+
| `modal_send` | `interaction_token`, `title`, `custom_id`, `fields` | `req_id` | Open a modal form in response to a component interaction |
195213

196214
<Callout type="note">
197215
Slash command interactions are automatically deferred with a "thinking" indicator. You must respond with either `interaction_followup` or `stream_start` (with the `interaction_token`) within 15 minutes, per Discord's limits.
@@ -226,12 +244,18 @@ Streaming lets you progressively update a single message, similar to how ChatGPT
226244
| `thread_create` | `channel_id`, `name` | `message_id`, `auto_archive_duration`, `content`, `req_id` | Create a thread (optionally from a message) |
227245
| `thread_send` | `thread_id`, `content` | `files`, `req_id` | Send a message to a thread |
228246
| `thread_list` | `channel_id` | `req_id` | List threads in a channel |
247+
| `thread_archive` | `thread_id` | `req_id` | Archive a thread |
248+
| `thread_rename` | `thread_id`, `name` | `req_id` | Rename a thread |
249+
| `thread_add_member` | `thread_id`, `user_id` | `req_id` | Add a member to a thread |
250+
| `thread_remove_member` | `thread_id`, `user_id` | `req_id` | Remove a member from a thread |
229251

230252
### Polls
231253

232254
| Action | Required Fields | Optional Fields | Description |
233255
|---|---|---|---|
234256
| `poll_send` | `channel_id`, `question`, `answers` | `duration_hours`, `multiple`, `content`, `req_id` | Create a poll in a channel |
257+
| `poll_results` | `channel_id`, `message_id` | `req_id` | Get current poll results |
258+
| `poll_end` | `channel_id`, `message_id` | `req_id` | End a poll early |
235259

236260
`answers` is an array of strings or objects with `text` and optional `emoji` fields. Minimum 2 answers required.
237261

@@ -242,13 +266,17 @@ Streaming lets you progressively update a single message, similar to how ChatGPT
242266
| `channel_list` | -- | `guild_id`, `req_id` | List channels (optionally filtered by server) |
243267
| `channel_create` | `guild_id`, `name` | `type`, `req_id` | Create a channel (`text`, `voice`, or `category`) |
244268
| `channel_info` | `channel_id` | `req_id` | Get channel details |
269+
| `channel_edit` | `channel_id` | `name`, `topic`, `nsfw`, `slowmode`, `req_id` | Edit channel settings |
270+
| `channel_set_permissions` | `channel_id`, `target_id`, `target_type` | `allow`, `deny`, `req_id` | Set permission overwrites for a role or member |
271+
| `forum_post` | `channel_id`, `name`, `content` | `tags`, `embed`, `req_id` | Create a post in a forum channel |
245272

246273
### Members
247274

248275
| Action | Required Fields | Optional Fields | Description |
249276
|---|---|---|---|
250277
| `member_list` | `guild_id` | `limit`, `req_id` | List server members (default limit: 50) |
251278
| `member_info` | `guild_id`, `member_id` | `req_id` | Get detailed member info including roles |
279+
| `member_timeout` | `guild_id`, `member_id`, `duration` | `reason`, `req_id` | Timeout a member (max 2419200s / 28 days, 0 to remove) |
252280

253281
### Roles
254282

@@ -257,6 +285,7 @@ Streaming lets you progressively update a single message, similar to how ChatGPT
257285
| `role_list` | `guild_id` | `req_id` | List server roles |
258286
| `role_assign` | `guild_id`, `member_id`, `role_id` | `req_id` | Assign a role to a member |
259287
| `role_remove` | `guild_id`, `member_id`, `role_id` | `req_id` | Remove a role from a member |
288+
| `role_edit` | `guild_id`, `role_id` | `name`, `color`, `permissions`, `req_id` | Edit role properties |
260289

261290
### DMs
262291

@@ -273,6 +302,28 @@ Streaming lets you progressively update a single message, similar to how ChatGPT
273302
| `message_search` | `channel_id` | `query`, `author`, `limit`, `req_id` | Search messages by content or author |
274303
| `message_pin` | `channel_id`, `message_id` | `req_id` | Pin a message |
275304
| `message_unpin` | `channel_id`, `message_id` | `req_id` | Unpin a message |
305+
| `message_bulk_delete` | `channel_id`, `message_ids` | `req_id` | Delete multiple messages at once (2-100, max 14 days old) |
306+
307+
### Reactions (extended)
308+
309+
| Action | Required Fields | Optional Fields | Description |
310+
|---|---|---|---|
311+
| `reaction_users` | `channel_id`, `message_id`, `emoji` | `limit`, `req_id` | List users who reacted with a specific emoji |
312+
313+
### Webhooks
314+
315+
| Action | Required Fields | Optional Fields | Description |
316+
|---|---|---|---|
317+
| `webhook_list` | `channel_id` | `req_id` | List webhooks for a channel |
318+
| `webhook_create` | `channel_id`, `name` | `avatar`, `req_id` | Create a webhook |
319+
| `webhook_delete` | `webhook_id` | `req_id` | Delete a webhook |
320+
321+
### Scheduled events
322+
323+
| Action | Required Fields | Optional Fields | Description |
324+
|---|---|---|---|
325+
| `event_list` | `guild_id` | `req_id` | List scheduled events |
326+
| `event_create` | `guild_id`, `name`, `start_time` | `end_time`, `description`, `channel_id`, `location`, `req_id` | Create a scheduled event |
276327

277328
### Server
278329

@@ -339,7 +390,11 @@ discli serve --channel "#general"
339390
discli serve --no-include-self
340391
```
341392

342-
Available event filter values: `messages`, `reactions`, `members`, `edits`, `deletes`.
393+
Available event filter values: `messages`, `reactions`, `members`, `edits`, `deletes`, `voice`, `interactions`.
394+
395+
<Callout type="note">
396+
The protocol currently supports **54 actions** and **17 event types**. See the [Serve Actions](/reference/serve-actions) and [Serve Events](/reference/serve-events) references for the complete list.
397+
</Callout>
343398

344399
## Slash command registration
345400

docs/docs-config.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@
5151
{ "label": "Streaming Responses", "href": "/guides/streaming-responses" },
5252
{ "label": "Slash Commands", "href": "/guides/slash-commands" },
5353
{ "label": "Security & Permissions", "href": "/guides/security-permissions" },
54-
{ "label": "Scripting & Automation", "href": "/guides/scripting-automation" }
54+
{ "label": "Scripting & Automation", "href": "/guides/scripting-automation" },
55+
{ "label": "Components & Modals", "href": "/guides/components-modals" },
56+
{ "label": "AI Agent", "href": "/guides/ai-agent" }
5557
]
5658
},
5759
{
@@ -61,7 +63,8 @@
6163
{ "label": "Moderation Bot", "href": "/use-cases/moderation-bot" },
6264
{ "label": "Thread-Based Support", "href": "/use-cases/thread-based-support" },
6365
{ "label": "Channel Logger", "href": "/use-cases/channel-logger" },
64-
{ "label": "CI Notifications", "href": "/use-cases/ci-notifications" }
66+
{ "label": "CI Notifications", "href": "/use-cases/ci-notifications" },
67+
{ "label": "AI Serve Agent", "href": "/use-cases/ai-serve-agent" }
6568
]
6669
},
6770
{
@@ -97,7 +100,8 @@
97100
{ "label": "CLI Commands", "href": "/reference/cli-commands" },
98101
{ "label": "Serve Actions", "href": "/reference/serve-actions" },
99102
{ "label": "Serve Events", "href": "/reference/serve-events" },
100-
{ "label": "Permission Profiles", "href": "/reference/permission-profiles" }
103+
{ "label": "Permission Profiles", "href": "/reference/permission-profiles" },
104+
{ "label": "Component Types", "href": "/reference/component-types" }
101105
]
102106
}
103107
]

docs/guides/building-agents.mdx

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,64 @@ if __name__ == "__main__":
794794

795795
---
796796

797+
## AI Serve Agent (`ai_serve_agent.py`)
798+
799+
Beyond the five levels above, discli ships with an example AI-powered agent that combines Claude (via the Anthropic Agent SDK) with `discli serve`. This is the recommended architecture for building intelligent Discord agents.
800+
801+
### Architecture
802+
803+
The AI serve agent uses a two-layer approach:
804+
805+
1. **Claude Agent SDK** provides the reasoning and decision-making layer
806+
2. **`discli serve`** provides the persistent Discord connection via JSONL
807+
3. **Bash tool calls** let Claude execute discli CLI commands for most operations (send messages, manage channels, list members, etc.)
808+
4. **Component blocks** let Claude declare rich UI elements inline
809+
810+
Claude reads events from `discli serve` stdout and decides how to respond. For standard actions, it runs CLI commands through Bash. For interactive UI elements like buttons, select menus, and modals, it uses fenced component blocks.
811+
812+
### Component blocks
813+
814+
The agent uses a special fenced code block syntax to declare message components:
815+
816+
````
817+
```component
818+
{
819+
"channel_id": "444555666",
820+
"content": "Choose an action:",
821+
"components": [
822+
{
823+
"type": "action_row",
824+
"components": [
825+
{"type": "button", "style": "primary", "label": "Approve", "custom_id": "approve"},
826+
{"type": "button", "style": "danger", "label": "Reject", "custom_id": "reject"}
827+
]
828+
}
829+
]
830+
}
831+
```
832+
````
833+
834+
The agent framework parses these blocks and sends them as JSONL actions to `discli serve`.
835+
836+
### Modal registry pattern
837+
838+
Modals require a two-step flow: first you send the modal to the user (`modal_send`), then you handle their submission (`modal_submit` event). The agent maintains a modal registry that maps `custom_id` values to handler functions, so when a `modal_submit` event arrives, the agent knows which handler to invoke.
839+
840+
### Example test messages
841+
842+
Try these messages to exercise the agent's capabilities:
843+
844+
- `@bot send a poll about favorite languages` -- creates a poll with buttons
845+
- `@bot show me server info` -- runs `discli server info` via Bash
846+
- `@bot create a feedback form` -- opens a modal dialog
847+
- `@bot set up a welcome channel` -- orchestrates channel creation and permissions
848+
849+
### Running the example
850+
851+
See [`agents/ai_serve_agent.py`](/agents/ai_serve_agent.py) for the full implementation. The agent requires the `anthropic` Python package and a valid `ANTHROPIC_API_KEY` environment variable.
852+
853+
---
854+
797855
## Choosing Your Level
798856

799857
<CardGroup cols={2}>

docs/guides/cli-usage.mdx

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ discli message send "#announcements" "New release!" \
4444
--embed-desc "Bug fixes and performance improvements"
4545
```
4646

47+
```bash Rich embed with color, footer, and fields
48+
discli message send "#announcements" "Check this out" \
49+
--embed-title "Status Update" \
50+
--embed-color 5865F2 \
51+
--embed-footer "Last updated today" \
52+
--embed-field "Service::Operational::true"
53+
```
54+
4755
</CodeGroup>
4856

4957
## Reading Messages
@@ -164,6 +172,9 @@ discli message edit "#general" 1234567890123456 "Updated content here"
164172

165173
# Delete a message (requires confirmation)
166174
discli message delete "#general" 1234567890123456
175+
176+
# Bulk delete multiple messages by ID
177+
discli -y message bulk-delete "#general" 111 222 333
167178
```
168179

169180
<Callout type="warning">
@@ -196,6 +207,28 @@ discli channel create "My Server" "voice-room" --type voice
196207

197208
# Create a category
198209
discli channel create "My Server" "Project Alpha" --type category
210+
211+
# Create a forum channel
212+
discli channel create "My Server" "feedback" --type forum --topic "Share your feedback"
213+
214+
# Create a forum post
215+
discli channel forum-post "#feedback" "Feature Request" "Add dark mode support"
216+
```
217+
</Tab>
218+
219+
<Tab title="Edit channels">
220+
```bash
221+
# Edit a channel's topic and slowmode
222+
discli channel edit "#general" --topic "New topic" --slowmode 10
223+
```
224+
</Tab>
225+
226+
<Tab title="Permissions">
227+
```bash
228+
# Set channel permissions for a role
229+
discli channel set-permissions "#general" "Members" \
230+
--allow send_messages \
231+
--deny manage_messages
199232
```
200233
</Tab>
201234

@@ -241,6 +274,12 @@ discli member ban "My Server" "@troll" --reason "Repeated violations"
241274

242275
# Unban
243276
discli member unban "My Server" "@reformed"
277+
278+
# Timeout a member for 1 hour (3600 seconds)
279+
discli -y member timeout "My Server" "@spammer" 3600 --reason "Spam"
280+
281+
# Remove a timeout (set duration to 0)
282+
discli -y member timeout "My Server" "@spammer" 0
244283
```
245284

246285
### The `--triggered-by` Flag
@@ -266,6 +305,9 @@ discli reaction remove "#general" 1234567890123456 "👍"
266305

267306
# List reactions on a message
268307
discli reaction list "#general" 1234567890123456
308+
309+
# List users who reacted with a specific emoji
310+
discli reaction users "#general" 1234567890123456 "👍"
269311
```
270312

271313
<Callout type="note">
@@ -298,6 +340,17 @@ discli thread send 9876543210 "Replying in the thread"
298340

299341
# Send with file attachment
300342
discli thread send 9876543210 "Here's the file" --file ./data.json
343+
344+
# Archive / unarchive a thread
345+
discli thread archive 9876543210
346+
discli thread unarchive 9876543210
347+
348+
# Rename a thread
349+
discli thread rename 9876543210 "New Thread Name"
350+
351+
# Add or remove a member from a thread
352+
discli thread add-member 9876543210 "@alice"
353+
discli thread remove-member 9876543210 "@alice"
301354
```
302355

303356
## Roles
@@ -315,6 +368,13 @@ discli role assign "My Server" "@alice" "Contributor"
315368
# Remove a role
316369
discli role remove "My Server" "@alice" "Contributor"
317370

371+
# Edit a role
372+
discli role edit "My Server" "Contributor" \
373+
--name "Core Contributor" \
374+
--color 00ff00 \
375+
--hoist \
376+
--mentionable
377+
318378
# Delete a role (confirmation required)
319379
discli role delete "My Server" "OldRole"
320380
```
@@ -337,6 +397,41 @@ discli --json server list | jq '.[] | {name, member_count}'
337397
```bash
338398
# Create a poll (via serve mode action)
339399
# See the Serve Mode guide for poll_send details
400+
401+
# View poll results
402+
discli poll results "#general" 1234567890123456
403+
404+
# End a poll early
405+
discli poll end "#general" 1234567890123456
406+
```
407+
408+
## Webhooks
409+
410+
```bash
411+
# List webhooks in a channel
412+
discli webhook list "#general"
413+
414+
# Create a webhook
415+
discli webhook create "#general" "Deploy Notifier"
416+
417+
# Delete a webhook (requires confirmation)
418+
discli -y webhook delete "#general" 9876543210
419+
```
420+
421+
## Scheduled Events
422+
423+
```bash
424+
# List scheduled events in a server
425+
discli event list "My Server"
426+
427+
# Create a scheduled event
428+
discli event create "My Server" "Game Night" \
429+
--start "2026-04-01T20:00:00" \
430+
--end "2026-04-01T23:00:00" \
431+
--description "Weekly game night"
432+
433+
# Delete a scheduled event (requires confirmation)
434+
discli -y event delete "My Server" 9876543210
340435
```
341436

342437
## Permission Profiles

0 commit comments

Comments
 (0)