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 the 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 Reset Token to generate a bot token
- Save the token -- you will not see it again
Step 3: Enable Privileged Gateway Intents
Under Bot > Privileged Gateway Intents, enable:
- Message Content Intent (required -- Moxxy needs to read message content)
Step 4: Invite the Bot to Your Server
- Go to OAuth2 > URL Generator
- Select scopes:
bot
- Select permissions:
- Send Messages
- Read Message History
- Copy the generated URL
- Open in browser and invite to your server
Step 5: Store the Bot Token in the Vault
curl -X POST http://localhost:3000/v1/vault/secrets \
-H "Authorization: Bearer mox_YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"key_name": "DISCORD_BOT_TOKEN",
"value": "YOUR_BOT_TOKEN",
"policy_label": "channel"
}'Step 6: Create the Discord Channel
Via CLI:
moxxy channel discordOr via API:
curl -X POST http://localhost:3000/v1/channels \
-H "Authorization: Bearer mox_YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"type": "discord",
"config": {
"bot_token_secret_ref": "secret-ref-uuid"
}
}'Step 7: Pair an Agent to a Server/Channel
curl -X POST http://localhost:3000/v1/channels/pair \
-H "Authorization: Bearer mox_YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "agent-uuid",
"channel_id": "discord-channel-uuid",
"external_chat_id": "discord-channel-id-here"
}'Pairing works the same as Telegram -- pairing codes can also be used for manual binding.
Step 8: Test
Mention the bot or send a message in the paired Discord channel. The bound agent should respond.
How It Works
Moxxy's Discord transport connects to the Discord Gateway and listens for messages. When a message arrives in a paired channel, the transport looks up the channel binding to determine which agent handles it.
Channel Bindings
Bindings are stored in the channel_bindings table:
| Field | Description |
|---|---|
agent_id | The agent handling this channel |
channel_id | The Discord channel configuration |
external_chat_id | The Discord channel/server ID |
Required Bot Permissions
| Permission | Purpose |
|---|---|
| Send Messages | Respond to users |
| Read Message History | See messages to respond to |
Required Privileged Intents
| Intent | Purpose |
|---|---|
| Message Content Intent | Read the content of messages (required) |
Without the Message Content Intent enabled, the bot will not be able to read message content and will not function correctly.
Usage
Mentioning the Bot
The bot responds when mentioned:
@MoxxyBot What can you do?Direct Messages
DM the bot directly for private conversations.
Server Integration
The bot operates within the Discord server where it has been invited and paired.
Troubleshooting
Bot Not Responding
- Verify the gateway is running on port 3000
- Check that the channel was created:
GET /v1/channels - Verify a binding exists for your Discord channel ID
- Confirm the bot token in the vault is valid
- Check that Message Content Intent is enabled in the Developer Portal
Missing Permissions
Error: Missing Permissions- Verify the bot role has Send Messages and Read Message History permissions
- Check role hierarchy in the server
- Re-invite the bot with the correct permissions
Intents Error
Error: Privileged intent not enabled- Go to the Discord Developer Portal
- Navigate to your application > Bot
- Enable Message Content Intent under Privileged Gateway Intents
- Save and restart the gateway
Bot Keeps Disconnecting
- Check network connectivity
- Verify the bot token is still valid
- Check the Discord status page for outages
- Review gateway logs
Security
- Bot tokens are stored in the vault, encrypted at rest
- Pairing ensures only authorized channels are bound to agents
- Use vault grants to control which agents can access the bot token
- Rotate bot tokens periodically via the Discord Developer Portal