Hermes Agent + Discord: Build a Community AI Bot

Why Discord + Hermes?

Discord is where developer communities live. Adding Hermes Agent to your Discord server transforms it into an AI-powered knowledge hub:

  • Slash commands β€” /ask, /code, /explain for quick interactions
  • Thread support β€” Long conversations in threads keep channels clean
  • Role-based access β€” Control who can use the bot
  • Rich formatting β€” Code blocks, embeds, and interactive buttons
  • Multi-channel β€” Different channels for different topics

Prerequisites

Step 1: Create a Discord Application

Register Your Bot

  • Go to the Discord Developer Portal
  • Click New Application and name it "Hermes AI"
  • Go to the Bot section in the sidebar
  • Click Add Bot β†’ Yes, do it!
  • Under Token, click Copy to get your bot token
  • MTIzNDU2Nzg5MDEy...your-bot-token-here
    

    Security note: Never share or commit this token. Anyone with it can control your bot.

    Set Bot Permissions

    In the Bot section:

    • Enable Message Content Intent (required to read messages)
    • Enable Server Members Intent (for role-based access)

    Go to OAuth2 β†’ URL Generator:

  • Select scopes: bot, applications.commands
  • Select permissions:
  • - Send Messages

    - Send Messages in Threads

    - Create Public Threads

    - Create Private Threads

    - Embed Links

    - Attach Files

    - Read Message History

    - Use Slash Commands

    - Add Reactions

  • Copy the generated URL and open it to invite the bot to your server
  • Step 2: Configure Hermes

    # Set Discord bot token
    

    hermes config set discord.bot_token "MTIzNDU2Nzg5MDEy...your-token"

    hermes config set discord.enabled true

    # Restrict to specific channels (optional but recommended)

    hermes config set discord.allowed_channels "[1234567890123456789]"

    Full Discord Configuration

    # ~/.hermes/config.yaml
    

    discord:

    enabled: true

    bot_token: "MTIzNDU2Nzg5MDEy..."

    # Access control

    allowed_channels: [1234567890123456789] # Channel IDs

    allowed_roles: ["AI-User", "Developer"] # Role names

    admin_roles: ["Admin", "Moderator"] # Can manage bot settings

    # Behavior

    respond_to_mentions: true # Respond when @mentioned

    respond_to_dms: true # Respond to direct messages

    use_threads: true # Create threads for long conversations

    thread_auto_archive: 1440 # Auto-archive threads after 24h (minutes)

    # Rate limiting

    max_requests_per_user: 30 # Per hour

    cooldown_seconds: 5 # Between messages

    # Display

    embed_color: "#d97706" # Hermes brand amber

    show_model_info: true # Show which model is responding

    show_token_usage: false # Show token count (admin only)

    Step 3: Register Slash Commands

    Hermes auto-registers slash commands when it starts. Here are the defaults:

    | Command | Description |

    |---------|-------------|

    | /ask | Ask Hermes a question |

    | /code | Generate code |

    | /explain | Explain code or a concept |

    | /review | Review code (with file attachment) |

    | /model | Switch AI model |

    | /session | Manage sessions |

    | /help | Show all commands |

    Step 4: Start the Bot

    Test Mode

    hermes discord start
    

    πŸ€– Discord bot online!
    

    Bot: Hermes AI#1234

    Servers: 2

    Channels: 3 (allowed)

    Slash commands: 7 registered

    Ready and listening...

    Production Mode with PM2

    pm2 start "hermes discord start" --name hermes-discord
    

    pm2 save

    Using Docker

    FROM node:18-alpine
    

    RUN npm install -g hermes-agent

    COPY config.yaml /root/.hermes/config.yaml

    CMD ["hermes", "discord", "start"]

    docker build -t hermes-discord .
    

    docker run -d --name hermes-discord \

    -e HERMES_API_KEY=sk-or-v1-your-key \

    hermes-discord

    Step 5: Using Hermes on Discord

    Slash Commands

    /ask How do I implement JWT authentication in Express?
    
    

    /code python Create a web scraper for Hacker News top stories

    /explain

    const memoize = (fn) => {

    const cache = new Map();

    return (...args) => {

    const key = JSON.stringify(args);

    if (cache.has(key)) return cache.get(key);

    const result = fn(...args);

    cache.set(key, result);

    return result;

    };

    };

    
    

    /review (attach a file)

    @Mention Mode

    When respond_to_mentions is enabled:

    @Hermes AI What's the best way to handle file uploads in Next.js?
    

    Hermes responds in a thread to keep the channel organized.

    Thread Conversations

    When threads are enabled, the first response creates a thread. All follow-ups happen in the thread:

    Channel: #dev-help
    

    β”œβ”€β”€ User: @Hermes AI Help me deploy to AWS

    β”‚ └── [Thread: Deploy to AWS]

    β”‚ β”œβ”€β”€ Hermes: Sure! Let me help you with AWS deployment...

    β”‚ β”œβ”€β”€ User: I want to use ECS

    β”‚ β”œβ”€β”€ Hermes: Great choice! Here's the ECS setup...

    β”‚ └── User: How about the load balancer?

    Advanced Configuration

    Role-Based Model Access

    Give different users access to different models:

    discord:
    

    role_models:

    "Free-Tier": "openai/gpt-4o-mini" # Budget model

    "Developer": "anthropic/claude-3.5-sonnet" # Full access

    "Admin": "anthropic/claude-3.5-sonnet" # Full access + settings

    Custom Slash Commands

    Define your own slash commands:

    discord:
    

    custom_commands:

    - name: "translate"

    description: "Translate text to another language"

    template: "Translate the following to {language}: {text}"

    parameters:

    - name: "text"

    type: "string"

    required: true

    - name: "language"

    type: "string"

    required: true

    choices: ["English", "Chinese", "Japanese", "Spanish"]

    - name: "summarize"

    description: "Summarize a URL or text"

    template: "Summarize this concisely: {input}"

    Channel-Specific Contexts

    Give Hermes different personas per channel:

    discord:
    

    channel_contexts:

    1234567890: # #coding-help

    system_prompt: "You are a coding assistant. Always provide code examples."

    model: "anthropic/claude-3.5-sonnet"

    9876543210: # #general

    system_prompt: "You are a friendly AI assistant. Keep responses brief."

    model: "openai/gpt-4o-mini"

    Security Best Practices

    • [ ] Set allowed_channels to prevent bot from responding everywhere
    • [ ] Configure allowed_roles for access control
    • [ ] Enable rate limiting to prevent API credit abuse
    • [ ] Use environment variables for the bot token
    • [ ] Monitor bot usage with show_token_usage (admin only)
    • [ ] Restrict file system access in Hermes config

    Troubleshooting

    Bot appears offline

    # Check if process is running
    

    pm2 status hermes-discord

    # Verify the token

    hermes discord test

    # Check Discord Developer Portal for any issues

    Slash commands not appearing

    Slash commands can take up to 1 hour to propagate globally. For immediate testing, use guild-specific commands:

    hermes discord register-commands --guild 1234567890
    

    Permission errors

    Make sure the bot has the required permissions in the channel:

    • Check server settings β†’ Roles β†’ Bot role
    • Check channel permissions β†’ Bot role overrides

    Next Steps


    Last updated: April 16, 2026 Β· Hermes Agent v0.8