Skip to content

A discord.py extension module to facilitate class-based creation of application commands.

License

Notifications You must be signed in to change notification settings

dolfies/discord-class-commands

Repository files navigation

discord-class-commands

Discord server invite PyPI version info PyPI supported Python versions

An extension module for discord.py that facilitates class-based creation of Discord application commands.

Credits

Key Features

  • Modern Pythonic API using async and await.
  • Proper rate limit handling.
  • Optimised in both speed and memory.
  • Fully compatible with discord.py's application command implementation without monkey-patching.

Installing

Python 3.8 or higher is required

To install the extension, you can just run the following command:

# Linux/macOS
python3 -m pip install -U discord-class-commands

# Windows
py -3 -m pip install -U discord-class-commands

To install the development version, do the following:

$ git clone https://github.com/dolfies/discord-class-commands
$ cd discord.py
$ python3 -m pip install -U .

This extension depends on version 2.0 of discord.py or a compatible fork.

Quick Example

import discord
from discord.ext import class_commands

client = discord.Client(intents=discord.Intents.default())
tree = discord.app_commands.CommandTree(client)

@client.event
async def setup_hook():
    await tree.sync()

class Ping(class_commands.SlashCommand):
    async def callback(self):
        await self.send(f'Pong!')

tree.add_command(Ping)
client.run('token')

You can find more examples in the examples directory.

Links

About

A discord.py extension module to facilitate class-based creation of application commands.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages