← Back to PRs

#22591: feat(cli): expose Discord channel lifecycle management through unified CLI interface (#22512)

by yinghaosang open 2026-02-21 10:45 View on GitHub →
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