Kerkpower / duckari

A Hikari command handler for people who love ducks.
Apache License 2.0
1 stars 0 forks source link

making a slash command (example): #3

Open UCYT5040 opened 2 years ago

UCYT5040 commented 2 years ago

@bot.slash() async def ping(ctx): #or whatever you need for a slash command# """"description"""" ctx.send("Pong!")

what you can add for slash commands (+ examples) after defining the function:

choices, makes a choice

Choice=["foo", "bar"]

integer, makes sure inputted text is an integer

Int=""

float, makes sure inputted text is a float

Float=""

boolean, like a choice command, but it can only be True or False

Bool=[]

string, allows the user to type smt

Str=""

and the required, which is added after one of the above optionally

Rqd=Bool

example

@bot.slash() async def echo(ctx): Str="", Rqd=True ctx.send(Str) (written by @Kerkpower)

UCYT5040 commented 2 years ago

options will have to be placed in the @bot.slash decorator, like @bot.slash(options=[OptionTypes.String(name="foo", description="bar")])