I’m working on a Discord bot using Python and running into a weird issue. When I use a slash command called /employee, the bot successfully sends an embed message to the channel. However, even though the message gets sent properly, Discord still shows “sending command” for about 5 seconds and then gives me an error saying “The application did not respond”.
Here’s my command code:
@client.tree.command(name="employee", description="Add employee to database")
async def employee(ctx: discord.Interaction):
msg_embed = discord.Embed(title="EMPLOYEE REGISTRATION", description="Register new employee in system", color=0xff5733)
msg_embed.add_field(name="Full Name", value="enter employee name here", inline=False)
msg_embed.set_footer(text="Company HR Department")
await ctx.channel.send(embed=msg_embed)
The embed gets posted correctly but something seems wrong with how Discord handles the interaction. What am I missing here?
yep this happend to me too! discord slash commands need a proper response or they timeout. using ctx.channel.send() doesnt count as responding to the interaction itself. try await ctx.response.send_message(embed=msg_embed) instead and it should fix the timeout issue
You’re encountering this because Discord slash commands require an explicit response within 3 seconds of execution. When you use ctx.channel.send(), you’re sending a message to the channel but not actually responding to the interaction itself. Discord waits for an interaction response and times out when it doesn’t receive one. Replace your current line with await ctx.response.send_message(embed=msg_embed) instead. This properly acknowledges the slash command interaction while still displaying your embed. The difference is subtle but critical - one responds to the interaction directly while the other just posts a message independently.
The issue arises from using ctx.channel.send() when handling a slash command in Discord. Instead of merely sending a message to the channel, you need to acknowledge the interaction directly. This is crucial because Discord expects a response to the interaction right away. If you don’t, it assumes there’s been a timeout, leading to the ‘application did not respond’ error. Modify your code to include await ctx.response.send_message(embed=msg_embed) to properly respond to the user’s command.