Search code examples
pythondiscorddiscord.py

Discord bot "The application did not respond" yet the command send?


Im working on my discord bot, And upon sending a slash command, the bot always seems to send a "The application did not respond" message even if the command works.

No errors show up in my log, Curious if anyone has a similar experience?

#Verify command
@bot.slash_command()
async def verify(ctx):
    await ctx.send(f"Welcome to the Galaxy!", delete_after=10)
    member = discord.utils.get(ctx.guild.roles, id=891110682110623806 )
    unverified = discord.utils.get(ctx.guild.roles, id=1012034653613477961)
    await ctx.author.add_roles(member)
    await ctx.author.remove_roles(unverified)

This is the code the message shows up on. Using /verify it gives the user roles, Takes away the other role correctly. Then still sends the message "The application did not respond" right after.


Solution

  • You should always send a response when using Slash Commands to prevent this error message to show up:

    #Verify command
    @bot.slash_command()
    async def verify(ctx):
        await ctx.send(f"Welcome to the Galaxy!", delete_after=10)
        member = discord.utils.get(ctx.guild.roles, id=891110682110623806 )
        unverified = discord.utils.get(ctx.guild.roles, id=1012034653613477961)
        await ctx.author.add_roles(member)
        await ctx.author.remove_roles(unverified)
        ctx.send("Roles added successfully")