Back to Blog
Guides7 min read

Discord Channel Settings: Connect Your AI Agent to Discord

By Bot It Out Team

Your Bot It Out agent can communicate through Discord using a standard Discord bot. This guide walks through every step — from creating your Discord application to configuring access controls for DMs and server channels.

How Discord Works on Bot It Out

Discord uses a single bot token to connect your agent. The bot joins your Discord server (called a "guild" in Discord's API) and can respond to direct messages and channel mentions.

Bot Token — a three-segment token from the Discord Developer Portal that identifies your bot and lets it send and receive messages.

Unlike Slack (which needs two tokens and Socket Mode), Discord's bot connects directly through Discord's Gateway API. One token is all you need.

Step 1: Create a Discord Application

  1. Go to [discord.com/developers/applications](https://discord.com/developers/applications).
  2. Click **New Application**.
  3. Give it a name (this will be your bot's display name) and click **Create**.

Step 2: Create the Bot and Get the Token

  1. In your application, go to the **Bot** tab in the left sidebar.
  2. Click **Reset Token** and confirm.
  3. **Copy the token immediately** — Discord only shows it once. If you lose it, you'll need to reset it again.

This is the token you'll paste into Bot It Out. It looks like three segments separated by dots: `MTIzNDU2Nzg5MDEy.GabcDE.aBcDeFgHiJkLmNoPqRsTuVwXyZ`

Step 3: Enable Message Content Intent

Still in the Bot tab:

  1. Scroll down to **Privileged Gateway Intents**.
  2. Enable **Message Content Intent**.
  3. Click **Save Changes**.

This is required for the bot to read the content of messages in server channels. Without it, the bot only sees that a message was sent but can't read what it says.

Step 4: Generate an Invite URL

  1. Go to **OAuth2** > **URL Generator** in the left sidebar.
  2. Under **Scopes**, check `bot`.
  3. Under **Bot Permissions**, check:

- Send Messages — lets the bot reply

- Read Message History — lets the bot see conversation context

  1. Copy the generated URL at the bottom of the page.

Step 5: Add the Bot to Your Server

  1. Paste the invite URL into your browser.
  2. Select the Discord server where you want the bot.
  3. Click **Authorize** and complete the captcha.

The bot now appears in your server's member list (it will show as offline until connected through Bot It Out).

Step 6: Connect in Bot It Out

  1. Open your instance dashboard.
  2. Expand the package you want to connect Discord to.
  3. Expand the **Discord** section.
  4. Paste the bot token.
  5. Configure your DM and server policies (see below).
  6. Click **Deploy Discord Channel**.

The bot will come online within a few seconds.

DM Access Policies

When someone sends a direct message to your bot, the DM policy controls what happens.

### Allowlist Only (Default)

Only specific Discord user IDs can DM the bot. Everyone else is silently ignored.

To find a user's ID: enable Developer Mode in Discord (Settings > Advanced > Developer Mode), then right-click the user and select Copy User ID. IDs are 17-20 digit numbers like `123456789012345678`.

Best for: Private bots where only specific people should have access. Internal team bots.

### Open to All

Any Discord user who shares a server with the bot can DM it and get a response.

Best for: Community bots. Bots where every server member should have access. Demo setups.

Note: "Open" means open to users who share a server with the bot, not the entire internet.

### Disabled

The agent ignores all direct messages. Useful when you only want the bot active in server channels.

Best for: Channel-only bots. Temporarily pausing DM access.

Server/Guild Settings

Guild policies control how the bot behaves in Discord server channels.

### Guild Policy

Disabled (Default) — The bot does not respond in any server channel, even if it's in the server. It stays completely silent in channels.

Allowlist — The bot only responds in servers whose IDs you specify. To find a server's ID: enable Developer Mode, then right-click the server name and select Copy Server ID. Enter IDs as a comma-separated list.

Open — The bot responds in any server it has been added to.

### Mention Behavior

In server channels, the bot always requires an @mention to respond. When someone types `@YourBotName` followed by a question, the agent activates. It also responds to direct replies to its own messages.

This prevents the bot from responding to every message in a busy channel.

### Custom Mention Patterns

Beyond the standard @mention, you can define custom trigger words. For example: `hey bot, ask-ai, !help`

Comma-separated, up to 10 patterns. The agent checks each channel message for these patterns and responds if any match.

Best for: Making the bot easier to invoke. Teams that prefer a shorthand like "hey bot" over a full @mention.

Common Configuration Examples

### Community Support Bot

  • DM Policy: Open
  • Guild Policy: Allowlist (your support server ID)
  • Mention Patterns: !help, ask bot
  • Why: Anyone in the server can DM or @mention it. Restricted to one server.

### Private Team Assistant

  • DM Policy: Allowlist (team member IDs)
  • Guild Policy: Disabled
  • Why: Only specific people can interact with it, purely through DMs.

### Multi-Server Bot

  • DM Policy: Open
  • Guild Policy: Open
  • Why: The bot responds everywhere it's invited. Good for bots that serve multiple communities.

### Channel-Only Bot

  • DM Policy: Disabled
  • Guild Policy: Allowlist (one server)
  • Mention Patterns: !ask
  • Why: No DMs. The bot only responds when triggered in a specific server's channels.

### Executive Assistant

  • DM Policy: Allowlist (one person)
  • Guild Policy: Disabled
  • Why: Private assistant for a single user through DMs.

Multi-Package Considerations

If your instance runs multiple agent packages and more than one has Discord configured, Bot It Out merges the policies automatically:

  • Most permissive policy wins. If Package A has DM policy "allowlist" and Package B has "open", the effective DM policy is "open".
  • Allowlists are unioned. All user IDs and guild IDs across packages are combined.
  • Mention patterns are merged. Custom triggers from all packages are active.

Each package gets its own bot token (its own Discord app), but they share the top-level policy configuration on the instance. This is because the gateway supports one set of access policies per instance.

Tip: If you need strict isolation between packages, keep their policies aligned or use separate instances.

Changing Settings

You can update Discord channel settings at any time from your instance dashboard. Changes take effect within a few seconds after the gateway restarts.

To fully disconnect Discord:

  • Click **Remove Channel** in the Discord section. This removes the bot token and stops all Discord message routing for that package.
  • If other packages still have Discord configured, their policies are re-merged and remain active.
  • The bot itself will still be in your Discord server — to fully remove it, kick the bot from your server in Discord settings.

Troubleshooting

Bot doesn't respond in server channels?

  • Check that the guild policy isn't "disabled"
  • If using allowlist, verify the server's guild ID is in the list
  • Make sure you're @mentioning the bot or using a custom trigger pattern
  • Verify Message Content Intent is enabled in the Discord Developer Portal

Bot doesn't respond to DMs?

  • Check the DM policy isn't "disabled"
  • If using allowlist, verify the user's Discord ID is in the list (17-20 digit number)
  • The user must share at least one server with the bot

Bot appears offline in Discord?

  • The bot token may be expired or regenerated — get a fresh token from the Developer Portal and update it in Bot It Out
  • Check that the instance is running (status should be "active" in the dashboard)

"Invalid bot token format" error?

  • Discord bot tokens have three segments separated by dots. Make sure you copied the full token from the Bot tab (not an OAuth2 token or client secret).

Ready to deploy your AI agent?

Get started free for 30 days.

Start Free