Prerequisites
- A Discord account
- Administrator access to a Discord server (for adding the bot)
Creating a Discord Bot
-
Go to Discord Developer Portal
- Visit https://discord.com/developers/applications
- Click “New Application”
- Name your application (e.g., “Weaver Bot”)
-
Create a Bot
- Navigate to the “Bot” section in the left sidebar
- Click “Add Bot” and confirm
- Click “Reset Token” to generate a bot token
- Save this token securely - it won’t be shown again
-
Configure Bot Permissions
- Under “Privileged Gateway Intents”, enable:
- ✅ Message Content Intent (required to read messages)
- Under “Bot Permissions”, select:
- ✅ Send Messages
- ✅ Read Messages/View Channels
- ✅ Read Message History
- ✅ Attach Files
- ✅ Add Reactions (optional)
- Under “Privileged Gateway Intents”, enable:
-
Generate Invite Link
- Go to “OAuth2” → “URL Generator”
- Select scopes:
bot - Select bot permissions (same as above)
- Copy the generated URL
-
Add Bot to Server
- Open the generated URL in your browser
- Select your server from the dropdown
- Click “Authorize”
Configuration
Add the Discord channel to yourconfig.yaml:
Configuration Options
| Field | Type | Required | Description |
|---|---|---|---|
enabled | boolean | Yes | Enable Discord channel |
token | string | Yes | Bot token from Developer Portal |
allow_from | array | No | Allowed Discord user IDs |
User ID Format
Discord uses 18-digit numeric IDs to identify users. Finding a User ID:- Enable Developer Mode in Discord:
- User Settings → Advanced → Developer Mode (toggle on)
- Right-click a user and select “Copy User ID”
- Add to
allow_from:"123456789012345678"
- Message the bot in a DM or mention it in a channel
- Check Weaver logs:
Supported Features
Message Types
- Text Messages - Full markdown support
- Attachments - Images, videos, files
- Audio Files - Transcribed if Groq is enabled
- Embeds - Basic support (future enhancement)
- Reactions - Can be added by bot
Message Handling
- Typing Indicator - Shows “Bot is typing…” while processing
- Long Messages - Automatically split into chunks (2000 char limit)
- Code Block Preservation - Smart splitting avoids breaking code blocks
- Concurrent Messages - Supports multiple users simultaneously
Attachment Processing
- Images/Files: Sent to agent as attachment URLs
- Audio Files: Downloaded and transcribed (if configured)
- Temporary Files: Cleaned up after processing
Message Splitting
Discord limits messages to 2000 characters. Weaver intelligently splits long messages:- Default split at 1500 characters (500 char safety buffer)
- Preserves code blocks (extends up to 2000 chars if needed)
- Splits on natural boundaries (newlines, spaces)
- Maintains formatting integrity
Audio Transcription
Enable audio transcription inconfig.yaml:
Bot Behavior
Direct Messages (DMs)
- Bot responds to all messages
- No mention required
Guild/Server Messages
- Bot only responds when mentioned:
@YourBot hello - Or when replying to bot’s messages
- Prevents spam in busy channels
Ignored Messages
- Messages from other bots (prevents bot loops)
- Messages from the bot itself
- System messages (joins, pins, etc.)
Connection Details
- Protocol: WebSocket Gateway
- Mode: Gateway API v10
- Intents: Guild Messages, Direct Messages, Message Content
- Auto-reconnect: Yes
Error Handling
Common Issues
Invalid Token- Verify token in Developer Portal
- Regenerate token if needed
- Check bot role in server settings
- Ensure bot has Send Messages permission
- Enable “Message Content Intent” in Developer Portal
- Bot must have this privileged intent enabled
- Add user ID to
allow_fromlist - Or remove
allow_fromto allow all users
Security Considerations
- Token Security: Never commit bot token to version control
- Message Content Intent: Required but considered privileged - verify bots under 100 servers
- Allowlist: Use
allow_fromto restrict bot access - Rate Limits: Discord enforces API rate limits (handled automatically)
Metadata Captured
Each Discord message includes:Example Configuration
Public Bot (All Users)
Private Bot (Allowlist)
Logging
Monitor Discord activity:Best Practices
- Set Bot Status: Use Discord Developer Portal to set “About Me” and status
- Create Dedicated Channels: Create bot-specific channels to organize conversations
- Use Roles: Assign a bot role with specific permissions
- Monitor Usage: Watch logs for unusual activity
- Test in Private Server: Create a test server for development
Advanced Features
The Discord channel supports:- Content Type Detection: Automatically identifies audio files by MIME type
- Graceful Degradation: Falls back to URL-only if download fails
- Concurrent Processing: Handles multiple users and channels simultaneously
- Timeout Control: 10-second timeout for message sending, 30-second for transcription
Next Steps
- Configure Agents to respond in Discord
- Set up Voice Transcription for audio files
- Enable Multimodal for image understanding