Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

A module for creating and using application commands on discord

License

Notifications You must be signed in to change notification settings

Rishiraj0100/dpy-appcommands

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dpy-appcommands

PyPi PyPi

Support

If you want any support then join my discord server

Installation

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__(
            name="blep",
            description = "Some blep description",
        )

    async def callback(self, ctx: InteractionContext, pleb: str = None):
        await ctx.reply(f"why {pleb}", ephemeral=True)

# or

@bot.slashcommand(name="test", description="test")
async def test(ctx):
    await ctx.send("tested")

# or

@bot.slashcommand(name="test2", description="test")
async def test(ctx):
    await ctx.respond(f"tested {ctx.author}")

@bot.event
async def on_ready():
    print(f'Logged on as {bot.user} (ID: {bot.user.id})')
    await bot.add_app_command(Blep(), on_discord=True) # awaited

bot.run("TOKEN")

Screenshots

image

image

image