Skip to content
This repository was archived by the owner on Mar 8, 2022. It is now read-only.

Application Commands

kuso edited this page Oct 14, 2021 · 1 revision

Intro

You maybe have heard something about them. "Slashcommands" or "Contextcommands". They're a new command system added to discord.

For example if you open up a discord chat and type in /, you'll see a bunch of commands popping up, for example /shrug, /spoiler and some more commands. Tehy are called slash commands.

Context commands are a bit more complicated?. They are currently limited to desktop versions of discord (PC, Laptop, ...). You can use them by right-clicking on a user or a message when you head to the Apps tab. There are two types of them. user context commands and message context commands

Usage

Enough talk, let's do some coding.

To create a simple slashcommand, we need to use the ui class which we previously created

@ui.slash.command()

You can create slashcommands with python decorators. All you gotta do is add that small piece of code before a callbackfunction

@ui.slash.command()
async def my_command(ctx):
    ...
Clone this wiki locally