Team25 min read

Discord Integration

Add AI to your Discord community. Moltbot brings intelligent moderation, slash commands, role management, and conversational AI to your server. Perfect for gaming communities, developer teams, and support servers.

Discord Bot Features

Slash Commands

Native Discord slash commands with auto-complete, options, and permissions.

Auto-Moderation

AI-powered content filtering, spam detection, and toxicity prevention.

Role Management

Self-assignable roles, reaction roles, and automated role assignments.

AI Conversations

Smart replies, Q&A support, and context-aware conversations in channels or DMs.

Setup Guide

1

Create Discord Application

Go to Discord Developer Portal:

  • Click "New Application"
  • Name your application (e.g., "Moltbot Assistant")
  • Go to "Bot" section in left sidebar
  • Click "Add Bot"
2

Configure Bot Settings

Enable these Privileged Gateway Intents:

Copy your Bot Token (keep it secret!)

3

OAuth2 & Permissions

Go to OAuth2 > URL Generator:

Select scopes:

  • bot
  • applications.commands

Bot permissions:

  • Send Messages, Read Messages
  • Embed Links, Attach Files
  • Read Message History
  • Add Reactions, Use Slash Commands

4. Moltbot Configuration

{
  "channels": {
    "discord": {
      "enabled": true,
      "token": "YOUR_BOT_TOKEN",
      "clientId": "YOUR_CLIENT_ID",
      "guildId": "YOUR_GUILD_ID",
      "intents": [
        "Guilds",
        "GuildMessages",
        "GuildMembers",
        "MessageContent"
      ],
      "commands": [
        {
          "name": "ask",
          "description": "Ask the AI assistant",
          "options": [
            {
              "name": "question",
              "description": "Your question",
              "type": 3,
              "required": true
            }
          ]
        },
        {
          "name": "summarize",
          "description": "Summarize recent messages"
        }
      ]
    }
  }
}

5. Bot Implementation

const { Client, Events, GatewayIntentBits } = require('discord.js');

const client = new Client({
  intents: [
    GatewayIntentBits.Guilds,
    GatewayIntentBits.GuildMessages,
    GatewayIntentBits.MessageContent,
    GatewayIntentBits.GuildMembers
  ]
});

// Ready event
client.once(Events.ClientReady, () => {
  console.log(`Logged in as ${client.user.tag}`);
});

// Handle slash commands
client.on(Events.InteractionCreate, async (interaction) => {
  if (!interaction.isChatInputCommand()) return;
  
  if (interaction.commandName === 'ask') {
    const question = interaction.options.getString('question');
    
    await interaction.deferReply();
    
    const response = await moltbot.process({
      message: question,
      userId: interaction.user.id,
      channelId: interaction.channelId
    });
    
    await interaction.editReply(response.text);
  }
});

// Handle regular messages (for AI conversations)
client.on(Events.MessageCreate, async (message) => {
  // Ignore bot messages
  if (message.author.bot) return;
  
  // Respond when mentioned or in specific channels
  if (message.mentions.has(client.user)) {
    const response = await moltbot.process({
      message: message.content,
      userId: message.author.id
    });
    
    await message.reply(response.text);
  }
});

client.login(process.env.DISCORD_TOKEN);

Popular Use Cases

Gaming Communities

Game guides, server status, event coordination, and player stats lookup.

Developer Teams

Code review assistance, documentation lookup, deployment notifications, CI/CD alerts.

Support Servers

FAQ automation, ticket creation, knowledge base search, and escalation handling.

Enhance Your Discord Server

Add AI capabilities to your community. Deploy Moltbot and give your members instant access to intelligent assistance.