Skip to content

Add scripts/bind-discord.sh — interactive Discord channel binding generator#22

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/add-discord-channel-binding-script
Draft

Add scripts/bind-discord.sh — interactive Discord channel binding generator#22
Copilot wants to merge 2 commits intomainfrom
copilot/add-discord-channel-binding-script

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 21, 2026

Generating the Discord channel binding config for openclaw.template.json required manually looking up guild/channel IDs — the most error-prone step in deployment. This script automates the full lookup and JSON generation.

scripts/bind-discord.sh

  • Accepts <bot-token> [--all]
  • Fetches guilds via GET /users/@me/guilds, then text channels (type 0 only) per guild via GET /guilds/{id}/channels
  • Interactive mode (stderr is a TTY): numbered channel list, space-separated selection or all
  • Non-interactive / --all: dumps every text channel without prompting
  • Stdout is pure JSON; all progress output goes to stderr — pipe-safe
  • DISCORD_API env var override for testability
$ ./scripts/bind-discord.sh "$DISCORD_BOT_TOKEN" --all
[
  {
    "guildId": "123456789",
    "guildName": "My Server",
    "channelId": "987654321",
    "channelName": "general"
  }
]

Paste the output array as channels inside the discord block of openclaw.template.json.

scripts/test-bind-discord.sh

Mock-curl test suite (12 cases) covering: argument validation, dependency checks, HTTP 401 handling, empty guild/channel error paths, voice channel exclusion, JSON field correctness, stderr isolation, and multi-guild collection.

Original prompt

This section details on the original issue you should resolve

<issue_title>Discord channel binding generator (bind-discord.sh)</issue_title>
<issue_description>The Discord openclaw.json channel binding config is the most error-prone manual step in deployment.

New script: scripts/bind-discord.sh <bot-token> that:

  1. Calls Discord API to fetch server list + channels
  2. Presents interactive selection or dumps all
  3. Generates the channel binding JSON block for openclaw.template.json

Eliminates hand-editing JSON channel IDs.

Implementation notes: no separate validation report docs in PR, keep docs minimal.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: dahifi <8903067+dahifi@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Discord channel binding generator script Add scripts/bind-discord.sh — interactive Discord channel binding generator Feb 21, 2026
Copilot AI requested a review from dahifi February 21, 2026 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discord channel binding generator (bind-discord.sh)

2 participants