Discord25 min · Lesson 1 of 3

Python Setup & Bot Instantiation

Set up your environment (PyPI, venv) and establish bird-eye connectivity with the Discord Gateway.

Bot Initialization

Modern Discord bot development relies on asynchronous Python. The discord.py library provides a comprehensive async API wrapping the Discord Gateway.

Simple Event Listening

import discord
from discord.ext import commands

class MyBot(commands.Bot):
    async def setup_hook(self):
        print(f'Logged in as {self.user}')

bot = MyBot(command_prefix='!', intents=discord.Intents.all())
bot.run('TOKEN')