OpenClaw operations guide

Set up your first OpenClaw Discord bot

Short answer. Create a Discord bot in the Developer Portal, connect its token on the Gateway host, and approve your first private DM. Start with a local CLI Gateway running as a managed service and a model that already replies in the dashboard.

Last updated · Published

By CWYN · Reviewed November 19, 2026 against OpenClaw 2026.11.5

Start with a local CLI Gateway running as a managed service and a model that already replies in the dashboard. Use a private Discord server you control.

1. Create the bot and copy its token

In the Discord Developer Portal, choose New Application, name it, and open Bot. Under Privileged Gateway Intents, enable Message Content Intent and Server Members Intent as shown in the Discord setup reference. Select Reset Token to generate the first token. Save it privately.

2. Invite the bot to your private server

In OAuth2 URL Generator, select bot and applications.commands. Under Bot Permissions, select View Channels, Send Messages, Read Message History, Embed Links, and Attach Files, the text setup baseline in the reference. Open the generated invite, select your test server, and authorize the bot. In the Discord app, open that server’s Privacy Settings and enable Direct Messages so the bot can send you a pairing code.

3. Install the plugin and connect the token

On the Gateway host, install the official Discord plugin. Add DISCORD_BOT_TOKEN to the private ~/.openclaw/.env file using your actual token. Keep existing entries and keep the token out of chat and shell commands.

openclaw plugins install @openclaw/discord

Save this JSON5 patch as discord.patch.json5 in your current directory. It references the token and uses DM pairing with server-channel handling disabled for the test.

{
  channels: {
    discord: {
      enabled: true,
      dmPolicy: "pairing",
      groupPolicy: "disabled",
      token: { source: "env", provider: "default", id: "DISCORD_BOT_TOKEN" },
    },
  },
}

Run the dry run to validate the patch and token reference. If it passes, apply the patch and restart the managed service so it reads the token.

openclaw config patch --file ./discord.patch.json5 --dry-run
openclaw config patch --file ./discord.patch.json5
openclaw gateway restart

4. Approve the DM you sent

Open a DM to the bot and send a message from your own account. Match the code in the bot’s reply to the pending request, then substitute that code for <CODE>. Read the pairing reference before approving, since the first CLI approval can establish the command owner.

openclaw pairing list discord
openclaw pairing approve discord <CODE>

5. Send a new message

In the same DM, send a new prompt and look for a model reply. The initial pairing message is held before it reaches the agent, so use a fresh prompt for the test.

Get your free CWYN Score

Next steps

Keep the setup behind the first Discord reply

Use the Gateway checklist and editable workspace files in the OpenClaw Complete Setup Pack ($14.95), an optional paid kit, to document your private Discord test.
Kit details as of Nov 22, 2026