Skip to content

Discord Setup

Discord is a solid channel for Moltbot, especially if you already live in Discord. Setup is a bit more involved than Telegram but way easier than WhatsApp.

The main difference: Discord has a concept of "intents" and "permissions" that you need to configure in their developer portal. It's not hard, but there are a few checkboxes that'll silently break things if you miss them.

Create a Discord Application

  1. Go to the Discord Developer Portal
  2. Click "New Application"
  3. Give it a name, agree to the terms
  4. You're in

Now you've got an application, but you don't have a bot yet.

Create the Bot User

  1. Click "Bot" in the left sidebar
  2. Click "Add Bot" (or "Reset Token" if one already exists)
  3. Copy the Bot Token

Keep that token safe. Same rules as Telegram: it's a password. Don't share it, don't commit it, don't post it anywhere.

Enable Intents

This part is important. Discord requires you to explicitly opt in to certain data.

Still on the Bot page, scroll down to Privileged Gateway Intents and enable:

  • Message Content Intent — without this, your bot can't read message text. At all. It'll see that a message was sent but won't know what it says. Yeah.
  • Server Members Intent — needed if you want the bot to know who's in the server

If you skip the Message Content Intent, your bot will seem like it's working but every message will be empty. This one trips up a lot of people.

  1. Go to "OAuth2" → "URL Generator" in the sidebar
  2. Under Scopes, check bot
  3. Under Bot Permissions, check:
    • Read Messages/View Channels
    • Send Messages
    • Read Message History
    • Use Slash Commands (optional but nice)
  4. Copy the generated URL
  5. Open it in your browser and pick which server to add the bot to

You need admin permissions on the server to add a bot.

Configure Moltbot

Environment Variable

bash
export DISCORD_BOT_TOKEN=your-discord-bot-token-here

Config File

yaml
# ~/.moltbot/config.yaml
channels:
  discord:
    botToken: "your-discord-bot-token-here"

Or run the wizard:

bash
moltbot configure --section discord

Start and Pair

bash
moltbot start

Go to your Discord server and DM the bot, or mention it in a channel. You'll see the pairing code in your terminal:

bash
moltbot pairing approve discord ABCD-1234

That's it. The bot should start responding.

How It Works in Servers

By default, Moltbot responds to:

  • Direct messages — always
  • Mentions in server channels — when someone @YourBot in a message
  • Replies to the bot's own messages

It ignores everything else. This is on purpose. You don't want your bot chiming in on every conversation in a busy server.

Custom Triggers

Want the bot to respond to a keyword instead of (or in addition to) mentions?

yaml
channels:
  discord:
    triggerPatterns:
      - "@mybot"
      - "!ask"
      - "hey bot"

Channel Restrictions

You can limit the bot to specific channels:

yaml
channels:
  discord:
    allowedChannels:
      - "bot-chat"
      - "ai-stuff"

If allowedChannels is set, the bot will only respond in those channels (plus DMs, which always work).

Slash Commands

Moltbot can register Discord slash commands if you want that /ask style interface:

yaml
channels:
  discord:
    slashCommands: true

After enabling this and restarting, you'll get /ask as a slash command. It might take up to an hour for Discord to propagate the command globally.

Honestly, most people just use @mentions. Slash commands are nice but not essential.

Embeds and Formatting

Discord supports rich embeds, and Moltbot takes advantage of them. Code blocks render nicely. Markdown works well. It's a better formatting experience than WhatsApp, though not quite as clean as Telegram.

Long responses get split automatically — Discord has a 2000-character message limit. Moltbot handles this for you, but very long AI responses might end up as 3-4 messages in a row.

Troubleshooting

Bot is online but doesn't respond

Nine times out of ten: Message Content Intent is not enabled. Go back to the Developer Portal → Bot → enable the intent. You need to restart Moltbot after changing intents.

Bot can't see certain channels

Check the bot's role permissions in your Discord server settings. The bot needs "View Channel" and "Read Message History" on whatever channels you want it in.

"Used a shared intent but not approved"

If your bot is in more than 100 servers, Discord requires you to apply for intent verification. For personal use, this won't be an issue.

Pairing code doesn't appear

Make sure the bot is actually in the server and has permission to read the channel you're messaging in. Check moltbot logs for errors.

Rate limited

Discord rate-limits bots aggressively. If your bot sends too many messages too fast, it'll get temporarily throttled. Moltbot handles basic rate limiting automatically, but if you're in a very active server, you might see delays.

Security Notes

Same applies here as everywhere: be careful about which servers you add the bot to. In a public server, anyone can talk to your bot, potentially triggering tool use, accessing memory, or running up your API costs.

For personal use, keep the bot in a private server with just you (or a small trusted group). Set your policies accordingly:

yaml
channels:
  discord:
    dmPolicy: "paired-only"
    groupPolicy: "mention-only"

What's Next

  • Security — especially if you're adding the bot to shared servers
  • Memory — works the same across all channels
  • MCP Tools — give your bot superpowers

Community tutorial site — not affiliated with official Moltbot