Skip to content

Instantly share code, notes, and snippets.

@pinheaded
pinheaded / cog_ext.py
Last active May 3, 2024 12:59
a basic cog + extension example for discord.py v2
from discord import app_commands
from discord.ext import commands
# all cogs inherit from this base class
class ExampleCog(commands.Cog):
def __init__(self, bot):
self.bot = bot # adding a bot attribute for easier access
# adding a command to the cog
@commands.command(name="ping")