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

# Discord

> Send messages, read history, and manage channels in Discord with DiscordTools.

**DiscordTools** enable an agent to send messages, read message history, manage channels, and delete messages in Discord.

## Prerequisites

The following example requires the `requests` and `openai` libraries and a Discord bot token which can be obtained from [here](https://discord.com/developers/applications).

```shell theme={null}
uv pip install -U requests openai
```

```shell theme={null}
export DISCORD_BOT_TOKEN=***
```

## Example

```python cookbook/91_tools/discord_tools.py theme={null}
from agno.agent import Agent
from agno.tools.discord import DiscordTools

agent = Agent(
    tools=[DiscordTools()],
    markdown=True,
)

agent.print_response("Send 'Hello World!' to channel 1234567890", markdown=True)
```

## Toolkit Params

| Parameter                     | Type            | Default | Description                                                                                       |
| ----------------------------- | --------------- | ------- | ------------------------------------------------------------------------------------------------- |
| `bot_token`                   | `Optional[str]` | `None`  | Discord bot token for authentication. Falls back to the `DISCORD_BOT_TOKEN` environment variable. |
| `enable_send_message`         | `bool`          | `True`  | Whether to enable sending messages to channels.                                                   |
| `enable_get_channel_messages` | `bool`          | `True`  | Whether to enable retrieving message history from channels.                                       |
| `enable_get_channel_info`     | `bool`          | `True`  | Whether to enable fetching channel info.                                                          |
| `enable_list_channels`        | `bool`          | `True`  | Whether to enable listing channels in a server.                                                   |
| `enable_delete_message`       | `bool`          | `True`  | Whether to enable deleting messages from channels.                                                |
| `all`                         | `bool`          | `False` | Enable all functions.                                                                             |

## Toolkit Functions

| Function               | Description                                                                                   |
| ---------------------- | --------------------------------------------------------------------------------------------- |
| `send_message`         | Send a message to a specified channel. Returns a success or error message.                    |
| `get_channel_info`     | Retrieve information about a specified channel. Returns the channel info as a JSON string.    |
| `list_channels`        | List all channels in a specified server (guild). Returns the list of channels as JSON.        |
| `get_channel_messages` | Retrieve message history from a specified channel. Returns messages as a JSON string.         |
| `delete_message`       | Delete a specific message by ID from a specified channel. Returns a success or error message. |

## Developer Resources

* [Tools](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/tools/discord.py)
