Skip to main content

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

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

discord-class-commands-1.1.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

discord_class_commands-1.1.0-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file discord-class-commands-1.1.0.tar.gz.

File metadata

File hashes

Hashes for discord-class-commands-1.1.0.tar.gz
Algorithm Hash digest
SHA256 662d27ad58a7153437d56f24fb10c8c2eb49f1ad0d9382b750da8c9fe7821eb7
MD5 43775daed6aaf3b54e99a9185b28ed58
BLAKE2b-256 3ac28aa5c07ee78a8aa0ad266a5d6d3e907c11b409d727f83b9b52cebefa7b0d

See more details on using hashes here.

File details

Details for the file discord_class_commands-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for discord_class_commands-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a49ed433d8373f539bd4925165201d35effbc33d56a5b2538c0eb98dd1f33734
MD5 ce7f65cf11ce235fba0c0e087c95600b
BLAKE2b-256 4c2f4113823fd24e3b427c8301d098141fb6ca70fb020f2dbba073379b5f4ce0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page