> ## Documentation Index
> Fetch the complete documentation index at: https://docs.phidata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Discord Agent

Discord is a popular messaging platform that allows you to interact with your friends, family, and colleagues.

Create a file `discord_agent.py` with the following code:

```python discord_agent.py theme={null}
import os
from phi.agent import Agent
from phi.tools.discord_tools import DiscordTools

# Create an agent with Discord tools
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=[DiscordTools()],
)

# Replace with your Discord IDs
channel_id = "YOUR_CHANNEL_ID"
server_id = "YOUR_SERVER_ID"

# Example 1: Send a message
discord_agent.print_response(f"Send a warm message to channel {channel_id}", stream=True)

# Example 2: Get channel info
discord_agent.print_response(f"Get information about channel {channel_id}", stream=True)

# Example 3: List channels
discord_agent.print_response(f"List all channels in server {server_id}", stream=True)
```

## Usage

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Install libraries">
    ```bash theme={null}
    pip install phidata
    ```
  </Step>

  <Step title="Set environment variables">
    ```bash theme={null}
    export DISCORD_BOT_TOKEN=****
    ```
  </Step>

  <Step title="Run the agent">
    ```bash theme={null}
    python discord_agent.py
    ```
  </Step>
</Steps>
