discord_slash: How to actually add a slash command/ why isn't mine working?

Viewed 3576

So I tried to add a slash command 'verify' to the / menu with discord_slash. It appears there and everything seems right.. Until I try to use the command. It should print the slash_ctx (just for test reasons) and send back 'ok', but instead it returns in discord 'Interaction Failed'.

Current Code

Creating the bot:

slashcomms = commands.Bot(command_prefix='_', intents=intents)

Creating the slash variable used to add the slash command:

slash = discord_slash.SlashCommand(slashcomms, sync_commands=True)

Adding 'verify' as slash command with the function:

@slash.slash(name="verify", description="Hiermit verifiziert ihr euch", guild_ids=[493472231691780117])
async def verify(ctx: discord_slash.SlashContext):
    print(ctx)
    await ctx.send("Ok")
1 Answers

Slash Commands are an extra "class" but you can recognize them as commands as they got no message content and you can put that in the on_message function to let the function ignore the command and after all that no more error occurees.

Related