Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

making a slash command (example): #3

Open
UCYT5040 opened this issue Nov 26, 2021 · 1 comment
Open

making a slash command (example): #3

UCYT5040 opened this issue Nov 26, 2021 · 1 comment

Comments

@UCYT5040
Copy link
Collaborator

@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
Copy link
Collaborator Author

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

@UCYT5040 UCYT5040 mentioned this issue Nov 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant