Slash Command works but gives error? [Answered]
Hi, I'm trying to make a Discord Bot in .Net 6 and my Slash Command works but after the command it gives the user a hidden message saying "Application didn't answer". This is kind of annoying and I don't know why it's saying that when the Task was completed
8 Replies
you have to respond to the interaction using RespondAsync wherever you're processing the logic for the command, whether that be in an interactionhandler class or via the slashcommandexecuted event
interaction.RespondAsync("pong");
Do you mean like this?
ye
Then I get this error:
App Command System.TimeoutException: Cannot respond to an interaction after 3 seconds!
at Discord.WebSocket.SocketCommandBase.RespondAsync(String text, Embed[] embeds, Boolean isTTS, Boolean ephemeral, AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options)
at Discord.WebSocket.SocketInteraction.Discord.IDiscordInteraction.RespondAsync(String text, Embed[] embeds, Boolean isTTS, Boolean ephemeral, AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options)
at Discord.Interactions.InteractionModuleBase`1.RespondAsync(String text, Embed[] embeds, Boolean isTTS, Boolean ephemeral, AllowedMentions allowedMentions, RequestOptions options, MessageComponent components, Embed embed)
what framework are u using, dsharpplus or discord.net?
add this to your DiscordSocketConfig if discord.net
It worked
Thanks a lot
./close
✅ This post has been marked as answered!