An extension module for discord.py that facilitates class-based creation of Discord application commands.
Credits
discord.py: Docs and various code snippets.
IAmTomahawkx: Initial idea and design.
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
Metadata
Release files for discord-class-commands 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| discord-class-commands-1.1.0.tar.gz | 11.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| discord_class_commands-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.5 kB
Release files / discord-class-commands-1.1.0.tar.gz
| Download URL | discord-class-commands-1.1.0.tar.gz |
|---|---|
| Size | 11.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
662d27ad58a7153437d56f24fb10c8c2eb49f1ad0d9382b750da8c9fe7821eb7
|
|
BLAKE2b-256 checksum How to use checksums |
3ac28aa5c07ee78a8aa0ad266a5d6d3e907c11b409d727f83b9b52cebefa7b0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|
Release files / discord_class_commands-1.1.0-py3-none-any.whl
| Download URL | discord_class_commands-1.1.0-py3-none-any.whl |
|---|---|
| Size | 13.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a49ed433d8373f539bd4925165201d35effbc33d56a5b2538c0eb98dd1f33734
|
|
BLAKE2b-256 checksum How to use checksums |
4c2f4113823fd24e3b427c8301d098141fb6ca70fb020f2dbba073379b5f4ce0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|