Skip to main content
discord_tools.py

Run the Example

1

Set up your virtual environment

2

Install dependencies

3

Export environment variables

4

Configure the Discord bot and IDs

Create a Discord application and bot. Enable the Message Content privileged intent in the bot settings, then install the bot in the target server with the bot scope and View Channels, Send Messages, and Read Message History permissions. Grant Manage Messages only if you enable deletion. Enable Developer Mode in Discord, then replace YOUR_CHANNEL_ID and YOUR_SERVER_ID in the saved Python file with IDs copied from that server.
5

Run the example

Save the code above as discord_tools.py, then run:
Full source: cookbook/91_tools/discord_tools.py