#Programmatically create slash commands

1 messages · Page 1 of 1 (latest)

dense arch
#

Hi everyone!

I need help making slash commands programmatically for canned responses, any ideas on what I'm doing wrong here as no commands are created

@listen()
async def on_ready(self):
    print("Ready!")
    # On ready, create a slash command for each canned response
    # self.responses is a list of tuples, where each tuple is a canned response
    for response in self.responses:
        print(f"Creating command for /{response[2]} with description {response[3]}")
        @slash_command(name=response[2], description=f"{response[3]}", scopes=[858547359804555264])
        async def canned_response(ctx: SlashContext):
            await ctx.send(response[1])

Output:

Ready!
Creating command for /test with description A test command
devout dockBOT
#

Hey! Once your issue is solved, press the button below to close this thread!

soft night
#

You'll need to resync the slash commands with discord