📚 API ReferencePlugins
Discord
Integrate your Agent with Discord, the popular chatting app.
Import
Setup
We highly recommend reading the Discord Developers documentation for in-depth help, and navigating through Discord's API.
Add Discord integration to your agent by following these steps:
Step 1: Create a Discord bot application
- Go to https://discord.com/developers/applications
- Click "New Application" and give it a name
Step 2: Configure bot settings
- From the sidebar, go to the Bot section to get the Token.
- Click on Reset Token to get your Token and save it somewhere securely.
Make sure to enable all three options here.
- Presence Intent ✓
- Server Members Intent ✓
- Message Content Intent ✓
Step 3: Add the bot to your server
- From the sidebar, go to the OAuth2 section
- At the OAuth2 URL Generator, check the
bot
option
- In the Bot Permissions, give the relevant permissions to the bot. To enable the bot to talk in the server and respond to messages, you should check "Send Messages". You can check other permissions based on what you want your bot to do.
- Scroll down a bit to copy the URL:
- Paste this URL in a new tab where you will have to:
- Select the server you want to add the bot to
- Authorize the bot
Usage
Add the following Component to your Agent:
When you run the following command to get your Discord Agent up and running:
You can now test it in the connected Discord server! Just mention it in one of the channels you specified, and see it talk.
You can see a more detailed guide for this in our Discord Agent example.
Additional Notes
- The bot will only respond in the specified channels and to whitelisted users (if configured)
- Voice channel support requires additional Discord permissions (see above)
- Channel names are case-sensitive and should match exactly
- For DMs, users must share a server with the bot
- The bot token should be kept secure and not committed to version control.
- You can use
.env.txt
and the useEnv() hook to load it at runtime. - If you need to reset the token for security reasons, you can do so in the Discord Developer Portal
- The bot requires a stable internet connection to maintain WebSocket connection with Discord
- Rate limits apply to bot actions - see Discord's developer documentation for details