Discord Channel
Connect your Moxxy agent to Discord as a bot.
Prerequisites
- A Discord account
- A Discord server where you have admin rights
- Access to Discord Developer Portal
Setup
Step 1: Create a Discord Application
- Go to Discord Developer Portal
- Click New Application
- Give it a name (e.g., "Moxxy Bot")
- Note your Application ID
Step 2: Create a Bot User
- Go to Bot in the left sidebar
- Click Add Bot
- Click Reset Token to generate a bot token
- 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
- Go to OAuth2 → URL Generator
- Select scopes:
- ✅ bot
- ✅ applications.commands (for slash commands)
- Select permissions:
- Send Messages
- Read Message History
- Mention Everyone
- Connect (for voice)
- Copy the generated URL
- Open in browser and invite to your server
Step 5: Connect to Moxxy
bash
moxxy channel discord --agent default --token YOUR_BOT_TOKENOr configure via vault:
bash
moxxy run --agent default --prompt "Store 'YOUR_BOT_TOKEN' in vault as discord_token"Then restart:
bash
moxxy gateway restartUsage
Mentioning the Bot
The bot responds when mentioned:
@MoxxyBot What can you do?Direct Messages
DM the bot directly for private conversations:
- Click on the bot's profile
- Send a message
Channel Responses
Bot responds in the same channel it was mentioned in.
Bot Permissions
Required Permissions
| Permission | Purpose |
|---|---|
| Send Messages | Respond to users |
| Read Message History | See messages to respond to |
| Embed Links | Send rich embeds |
| Attach Files | Send files |
Optional Permissions
| Permission | Purpose |
|---|---|
| Mention Everyone | Broadcast messages |
| Connect | Voice channel support |
| Speak | Voice responses |
Configuration
Vault Keys
| Key | Description |
|---|---|
discord_token | Bot token |
discord_guild_id | Restrict to specific server |
discord_prefix | Command 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
| Command | Description |
|---|---|
/help | Show help message |
/skills | List available skills |
/status | Show bot status |
/new | Start 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:
| Type | Limit |
|---|---|
| Global | 50 requests/second |
| Per Channel | 5 messages/second |
| Per Server | Varies |
Moxxy handles rate limiting automatically.
Troubleshooting
Bot Not Responding
- Check bot is online in Discord
- Verify bot token:bash
moxxy run --agent default --prompt "Check discord_token" - Check gateway logs:bash
moxxy logs | grep -i discord - Verify Message Content Intent is enabled
Permission Errors
Error: Missing Permissions- Check bot role has required permissions
- Verify role hierarchy (bot role should be high enough)
- Re-invite bot with correct permissions
Bot Keeps Disconnecting
- Check network stability
- Verify token is valid
- Check Discord status page
- Review gateway logs
Intents Not Working
Error: Privileged intent not enabled- Go to Developer Portal
- Enable required intents under Bot settings
- Save changes
- 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/guildsSecurity Best Practices
- Never share your bot token
- Use role restrictions to limit access
- Monitor bot usage via logs
- Regenerate token if compromised
- 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 detectedTeam 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