Social
Discord Tools
Examples
- Introduction
- Getting Started
- Agents
- Teams
- Workflows
- Applications
Agent Concepts
- Multimodal
- RAG
- Knowledge
- Memory
- Async
- Hybrid Search
- Storage
- Tools
- Search
- Social
- Web Scraping
- Database
- Local
- APIs & External Services
- Vector Databases
- Embedders
Models
- Anthropic
- AWS Bedrock
- AWS Bedrock Claude
- Azure AI Foundry
- Azure OpenAI
- Cohere
- DeepInfra
- DeepSeek
- Fireworks
- Gemini
- Groq
- Hugging Face
- Mistral
- NVIDIA
- Ollama
- OpenAI
- Perplexity
- Together
- xAI
- IBM
- LM Studio
- LiteLLM
- LiteLLM OpenAI
Social
Discord Tools
Code
cookbook/tools/discord_tools.py
from agno.agent import Agent
from agno.tools.discord import DiscordTools
discord_tools = DiscordTools(
bot_token=discord_token,
enable_messaging=True,
enable_history=True,
enable_channel_management=True,
enable_message_management=True,
)
discord_agent = Agent(
name="Discord Agent",
instructions=[
"You are a Discord bot that can perform various operations.",
"You can send messages, read message history, manage channels, and delete messages.",
],
tools=[discord_tools],
show_tool_calls=True,
markdown=True,
)
channel_id = "YOUR_CHANNEL_ID"
server_id = "YOUR_SERVER_ID"
discord_agent.print_response(
f"Send a message 'Hello from Agno!' to channel {channel_id}", stream=True
)
discord_agent.print_response(f"Get information about channel {channel_id}", stream=True)
discord_agent.print_response(f"List all channels in server {server_id}", stream=True)
discord_agent.print_response(
f"Get the last 5 messages from channel {channel_id}", stream=True
)
Usage
1
Create a virtual environment
Open the Terminal
and create a python virtual environment.
python3 -m venv .venv
source .venv/bin/activate
2
Set your Discord token
export DISCORD_BOT_TOKEN=xxx
export OPENAI_API_KEY=xxx
3
Install libraries
pip install -U discord.py openai agno
4
Run Agent
python cookbook/tools/discord_tools.py