Quickstart

Important

This guide expects you already have the installed in your environment.

Prerequisites

  1. Create your .env file

Your .env file should contain the following keys:

  • APPLICATION_TOKEN: The bot token of your application. You can get this in the Bot tab of your application’s Developer Portal.

Steps

  1. Import modules

from discord import Client
from discord.flags import GatewayIntent
  1. Configure client

intents = GatewayIntents.default()
client = Client(intents = intents)
  1. Register event listeners

@client.event_listener("READY")
async def _(event: ReadyEvent) -> None:
  print("Client is ready!")

See also

Event Reference

  1. Connect to Discord API

client.connect()