A module for creating and using application commands on discord.
Project description
dpy-appcommands
Installation and Usage
To install this module, run
pip install -U dpy-appcommands
Usage
For a headstart, here's an example
but if you want to view full
documentation on it then click here
import appcommands
from discord.ext import commands
bot = appcommands.Bot(command_prefix=commands.when_mentioned_or('?'))
class Blep(SlashCommand):
def __init__(self):
super().__init__(
bot.appclient,
name="blep",
description = "Some blep description",
callback = self.callback
)
async def callback(self, ctx: InteractionContext, pleb: str = None):
await ctx.reply(f"why {pleb}", ephemeral=True)
# or
@bot.slash(name="test", description="test")
async def test(ctx):
await ctx.reply("tested")
# or
@bot.appclient.command(name="test2", description="test")
async def test(ctx):
await ctx.reply(f"tested {ctx.author}")
@bot.event
async def on_ready():
print(f'Logged on as {bot.user} (ID: {bot.user.id})')
await bot.appclient.add_command(Blep())
bot.run("TOKEN")
Screenshots
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dpy-appcommands-1.0.0.tar.gz
(13.8 kB
view hashes)
Built Distribution
Close
Hashes for dpy_appcommands-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd63534db071d18f9a3ae2452ee334df9a2de7f8b81f53a9098df026a705946b |
|
MD5 | 4ecdad7073d15798cb5ee1cbf1528e50 |
|
BLAKE2b-256 | fd0e2d28e9071f0649c9887f077a61d4cbcd6fd1a64d67153abacf07fdd92ecb |