Skip to main content
Connect Spacebot to your Discord server. Takes about 5 minutes. You need a Bot Token from a Discord application.

Step 1: Create an Application

1

Open the Developer Portal

Go to discord.com/developers/applications and click New Application.Name it whatever you want — this is the internal name, not the bot’s display name.
2

Create a Bot

In your application settings, go to Bot:
  • Click Add Bot
  • Copy the bot token — you’ll need this in a moment
  • Scroll down to Privileged Gateway Intents and enable Message Content Intent
3

Enable Message Content Intent

Message Content Intent is required. Without it, the bot cannot see message content and will fail with “Disallowed intent(s)” error. Make sure it’s enabled and you’ve clicked Save Changes at the bottom of the Bot page.

Step 2: Set Bot Permissions

In your application settings, go to OAuth2URL Generator:
  • Scopes: bot
  • Bot Permissions:
    • Send Messages
    • Send Messages in Threads
    • Create Public Threads
    • Read Message History
    • Embed Links
    • Attach Files
    • Add Reactions
Copy the generated URL and open it in your browser to invite the bot to your server.

Step 3: Get Your Guild ID

In Discord, enable Developer Mode:
  1. Open User SettingsAdvanced
  2. Toggle on Developer Mode
  3. Right-click your server name → Copy Server ID
This is your guild ID.

Step 4: Add Token to Spacebot

config.toml
[messaging.discord]
enabled = true
token = "your-bot-token"

[[bindings]]
agent_id = "main"
channel = "discord"
guild_id = "YOUR_GUILD_ID"
You can also reference environment variables:
config.toml
[messaging.discord]
enabled = true
token = "env:DISCORD_BOT_TOKEN"
Token changes in config require a restart.

Verify It’s Working

Send a message in a channel the bot has access to. You should see:
  1. A typing indicator while the bot processes your message
  2. A reply from the bot
If the bot doesn’t respond, check the troubleshooting section below.

Filtering

Restrict to Specific Channels

By default the bot responds in every channel it has access to. To limit it, add channel IDs to your binding.
config.toml
[[bindings]]
agent_id = "main"
channel = "discord"
guild_id = "123456789"
channel_ids = ["111111", "222222"]
If channel_ids is empty or omitted, the bot responds in all channels.

Require Mentions Per Channel

Set require_mention = true on a Discord binding to only process messages that either:
  • Explicitly @mention the bot, or
  • Reply to a bot message
config.toml
[[bindings]]
agent_id = "main"
channel = "discord"
guild_id = "123456789"
channel_ids = ["111111", "222222"]
require_mention = true
This works well for busy channels where you only want direct interactions.

DM Filtering

By default, all DMs are ignored. To allow specific users, add their Discord user IDs.
config.toml
[messaging.discord]
dm_allowed_users = ["USER_ID_1", "USER_ID_2"]
You can also set per-binding DM allowlists:
config.toml
[[bindings]]
agent_id = "main"
channel = "discord"
guild_id = "123456789"
dm_allowed_users = ["USER_ID_3"]
Per-binding lists are merged with the instance-wide list. Permission changes hot-reload within a couple seconds — no restart needed.

Multiple Servers

Route different Discord servers to different agents.
config.toml
[[bindings]]
agent_id = "main"
channel = "discord"
guild_id = "123456789"

[[bindings]]
agent_id = "dev-bot"
channel = "discord"
guild_id = "987654321"
Each agent has its own memory, identity, and conversation history.

Threads

Threads get their own separate conversation with isolated history. Messages in the main channel share one conversation. Threads are the natural fit for isolated conversations in a busy server. The bot can create threads from messages when responding with OutboundResponse::ThreadReply. If thread creation fails (missing permissions or DM context), it falls back to a regular message.

Rich Messages

Discord supports rich message features:

Embeds

Cards with titles, descriptions, fields, colors, and footers. Up to 10 embeds per message.

Interactive Elements

  • Buttons — Primary, Secondary, Success, Danger, and Link styles. Max 5 per row.
  • Select Menus — Dropdown selection with custom options

Polls

Create polls with:
  • Up to 10 answer options
  • Duration between 1 and 720 hours
  • Multiselect support

Troubleshooting

SymptomCauseFix
Disallowed intent(s) error in logsMessage Content Intent not enabledDiscord Developer Portal → Bot → enable Message Content Intent → Save Changes
Bot connects but doesn’t see messagesMessage Content Intent disabledDiscord Developer Portal → Bot → enable Message Content Intent
Bot doesn’t respond in channelNo accessMake sure the bot has permissions in that channel
Bot doesn’t respond to DMsDM filteringAdd user ID to dm_allowed_users
Bot responds in wrong channelsNo channel filterAdd channel_ids to your binding
401 Unauthorized on startupInvalid tokenCopy a fresh token from the Developer Portal

Next Steps

Configure Permissions

Set up channel filters and access control

Agent Configuration

Create multiple agents for different servers

Message Coalescing

Learn how burst handling works

Build docs developers (and LLMs) love