#22591: feat(cli): expose Discord channel lifecycle management through unified CLI interface (#22512)
cli
size: S
trusted-contributor
## Summary
`openclaw message channel` only had `info` and `list`, but the backend already handles `channel-create`, `channel-edit`, `channel-delete`, and `channel-move` — agents use them all the time via the `message` tool. This wires up the missing CLI subcommands so you can script channel management without an agent session.
Closes #22512
lobster-biscuit
## Changes
- Before: creating/editing/moving/deleting a Discord channel required an agent tool call
- After: `openclaw message channel create/edit/delete/move` works from the CLI
New subcommands on the existing `channel` command group in `register.discord-admin.ts`:
- `channel create` — requires `--guild-id`, `--name`; optional `--type`, `--parent-id`, `--topic`, `--position`, `--nsfw`
- `channel edit` — requires `--channel-id`; optional `--name`, `--topic`, `--position`, `--parent-id`, `--nsfw`
- `channel delete` — requires `--channel-id`
- `channel move` — requires `--guild-id`, `--channel-id`; optional `--parent-id`, `--position`
Follows the same pattern as `role add`/`role remove`/`event create` — pure commander wiring, no new logic.
## Tests
- `register.discord-admin.test.ts` — 4 new tests verifying subcommand registration and required options
- `actions.test.ts` — 44 existing backend handler tests still pass (covers the actual `channel-create`/`channel-edit` param forwarding)
- `pnpm build && pnpm check` pass
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Adds four new CLI subcommands to `openclaw message channel` for managing Discord channels: `create`, `edit`, `delete`, and `move`. These commands wire up existing backend handlers (`channel-create`, `channel-edit`, `channel-delete`, `channel-move`) that were previously only accessible via agent tool calls.
**Key changes:**
- `channel create`: requires `--guild-id` and `--name`, with optional `--type`, `--parent-id`, `--topic`, `--position`, `--nsfw`
- `channel edit`: requires `--channel-id`, with optional `--name`, `--topic`, `--position`, `--parent-id`, `--nsfw`
- `channel delete`: requires `--channel-id`
- `channel move`: requires `--guild-id` and `--channel-id`, with optional `--parent-id` and `--position`
The implementation follows the existing pattern used for `role add`/`remove` and `event create`. The new test file verifies subcommand registration and required options. Backend handlers in `handle-action.guild-admin.ts` already exist and accept these parameters (Commander.js automatically converts `--guild-id` to `guildId` in the options object).
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- Pure CLI wiring that follows established patterns - no new logic, backend handlers already exist and tested, parameter names align correctly via Commander's automatic camelCase conversion
- No files require special attention
<sub>Last reviewed commit: 4178d65</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#11491: feat(slack): allow agents to resolve channel IDs to names and list ...
by Lukavyi · 2026-02-07
78.6%
#16685: Fix cli agents/approvals/discord routing edge cases
by craftowen · 2026-02-15
76.9%
#17648: fix: Discord guild channel detection using rawMessage.guild_id
by MisterGuy420 · 2026-02-16
75.6%
#22260: feat(extensions/deltachat): add Delta.Chat channel extension
by alanz · 2026-02-20
75.6%
#17254: fix(discord): intercept text-based slash commands instead of forwar...
by robbyczgw-cla · 2026-02-15
74.6%
#12204: fix(discord): resolve numeric guildId/channelId pairs in channel al...
by mcaxtr · 2026-02-09
74.6%
#15626: Slack: add channel create for message tool
by imWildCat · 2026-02-13
74.6%
#14318: feat(discord): enforce outbound allowlist on send functions
by builtbyrobben · 2026-02-11
74.4%
#21271: fix(commands): pass channel/capabilities/shell/os to runtime in com...
by evansantos · 2026-02-19
74.4%
#19615: fix(discord): include default account when sub-accounts are configured
by prue-starfield · 2026-02-18
74.3%