Skip to content

Discord Channel

Connect your Moxxy agent to Discord as a bot.

Prerequisites

  1. A Discord account
  2. A Discord server where you have admin rights
  3. Access to Discord Developer Portal

Setup

Step 1: Create a Discord Application

  1. Go to Discord Developer Portal
  2. Click New Application
  3. Give it a name (e.g., "Moxxy Bot")
  4. Note your Application ID

Step 2: Create a Bot User

  1. Go to Bot in the left sidebar
  2. Click Add Bot
  3. Click Reset Token to generate a bot token
  4. Save the token - you won't see it again!

Step 3: Configure Permissions

Under Privileged Gateway Intents:

  • ✅ Message Content Intent
  • ✅ Server Members Intent (optional)

Step 4: Invite the Bot

  1. Go to OAuth2URL Generator
  2. Select scopes:
    • ✅ bot
    • ✅ applications.commands (for slash commands)
  3. Select permissions:
    • Send Messages
    • Read Message History
    • Mention Everyone
    • Connect (for voice)
  4. Copy the generated URL
  5. Open in browser and invite to your server

Step 5: Connect to Moxxy

bash
moxxy channel discord --agent default --token YOUR_BOT_TOKEN

Or configure via vault:

bash
moxxy run --agent default --prompt "Store 'YOUR_BOT_TOKEN' in vault as discord_token"

Then restart:

bash
moxxy gateway restart

Usage

Mentioning the Bot

The bot responds when mentioned:

@MoxxyBot What can you do?

Direct Messages

DM the bot directly for private conversations:

  1. Click on the bot's profile
  2. Send a message

Channel Responses

Bot responds in the same channel it was mentioned in.

Bot Permissions

Required Permissions

PermissionPurpose
Send MessagesRespond to users
Read Message HistorySee messages to respond to
Embed LinksSend rich embeds
Attach FilesSend files

Optional Permissions

PermissionPurpose
Mention EveryoneBroadcast messages
ConnectVoice channel support
SpeakVoice responses

Configuration

Vault Keys

KeyDescription
discord_tokenBot token
discord_guild_idRestrict to specific server
discord_prefixCommand prefix (default: mention)

Environment Variables

bash
export DISCORD_BOT_TOKEN="your_token_here"

Slash Commands

Discord supports slash commands for better UX:

Register Commands

bash
# Via Moxxy (when slash commands are enabled)
moxxy run --agent default --prompt "Register Discord slash commands: help, skills, status"

Available Commands

CommandDescription
/helpShow help message
/skillsList available skills
/statusShow bot status
/newStart fresh session

Rich Embeds

Bot can send formatted embeds:

User: @MoxxyBot Show me the server status

Bot: [Embed]
┌─────────────────────────────────┐
│ Server Status                    │
│ ─────────────────────────────── │
│ CPU: 23%                         │
│ Memory: 4.2GB / 16GB            │
│ Disk: 120GB / 500GB             │
│ Status: ✅ Online                │
└─────────────────────────────────┘

Advanced Features

Multiple Servers

Bot can be in multiple servers:

bash
# Each server uses the same agent
# Or configure different agents per server
moxxy run --agent default --prompt "Store 'server_id_1:agent1,server_id_2:agent2' in vault as discord_server_mapping"

Role-Based Access

Restrict bot usage by role:

bash
moxxy run --agent default --prompt "Store 'admin,moderator' in vault as discord_allowed_roles"

Channel Restrictions

Limit to specific channels:

bash
moxxy run --agent default --prompt "Store 'general,bots' in vault as discord_allowed_channels"

Reaction Responses

Bot can react to messages:

bash
moxxy run --agent default --prompt "Store 'true' in vault as discord_auto_react"

Rate Limits

Discord rate limits:

TypeLimit
Global50 requests/second
Per Channel5 messages/second
Per ServerVaries

Moxxy handles rate limiting automatically.

Troubleshooting

Bot Not Responding

  1. Check bot is online in Discord
  2. Verify bot token:
    bash
    moxxy run --agent default --prompt "Check discord_token"
  3. Check gateway logs:
    bash
    moxxy logs | grep -i discord
  4. Verify Message Content Intent is enabled

Permission Errors

Error: Missing Permissions
  1. Check bot role has required permissions
  2. Verify role hierarchy (bot role should be high enough)
  3. Re-invite bot with correct permissions

Bot Keeps Disconnecting

  1. Check network stability
  2. Verify token is valid
  3. Check Discord status page
  4. Review gateway logs

Intents Not Working

Error: Privileged intent not enabled
  1. Go to Developer Portal
  2. Enable required intents under Bot settings
  3. Save changes
  4. Restart gateway

API Reference

Send Message

bash
curl -X POST http://localhost:17890/api/agents/default/discord/send \
  -H "Content-Type: application/json" \
  -d '{
    "channel_id": "123456789012345678",
    "content": "Hello from Moxxy!"
  }'

Send Embed

bash
curl -X POST http://localhost:17890/api/agents/default/discord/send \
  -H "Content-Type: application/json" \
  -d '{
    "channel_id": "123456789012345678",
    "embed": {
      "title": "Server Status",
      "description": "All systems operational",
      "color": 65280,
      "fields": [
        {"name": "CPU", "value": "23%", "inline": true},
        {"name": "Memory", "value": "4.2GB", "inline": true}
      ]
    }
  }'

Get Server Info

bash
curl http://localhost:17890/api/agents/default/discord/guilds

Security Best Practices

  1. Never share your bot token
  2. Use role restrictions to limit access
  3. Monitor bot usage via logs
  4. Regenerate token if compromised
  5. Use environment variables in production

Examples

Server Management

User: @MoxxyBot Check the server logs for errors

Bot: I'll check the server logs.
[Uses host_shell skill]
Found 3 errors in the last hour:
1. [ERROR] Connection timeout to database
2. [ERROR] Failed to process request #4521
3. [WARN] High memory usage detected

Team Notifications

User: @MoxxyBot Alert @everyone when the deployment is done

Bot: I'll monitor the deployment and notify everyone when complete.
[Uses skills to monitor]

Interactive Help

User: @MoxxyBot How do I use the git skill?

Bot: The git skill allows you to perform Git operations:

**Available commands:**
- Clone repositories
- Create branches
- Commit changes
- Push to remote

**Example:**

Clone the repo from https://github.com/example/project

Open source · Self-hosted · Data sovereign