[Bug]: RespondAsync empty throws an unhandled exception
Leuchty opened this issue · 2 comments
Check The Docs
- I double checked the docs and couldn't find any useful information.
Verify Issue Source
- I verified the issue was caused by Discord.Net.
Check your intents
- I double checked that I have the required intents.
Description
When responding to an interaction with RespondAsync and not passing any parameters to the method the console logs an unhandled exception has occured. When adding a message it works just fine. Why does RespondAsync have a method overload without any parameters if using it throws an exception?
Version
3.13.1
Working Version
No response
Logs
log message: Connected
log message: Ready
log message: A InteractionCreated handler has thrown an unhandled exception.
Sample
public static async Task ButtonExecuted(SocketMessageComponent component)
{
if (component.Data.CustomId == ButtonId)
{
//here I do some stuff
}
//I want discord to know, that i responded without sending any message
await component.RespondAsync();
}
Packages
none
Environment
- OS: Windows 11 23H2 22631.3155 - Architecture: x64 - SDK: .NET sdk 8.0
A discord message can't be empty, it must have at least one of:
- content
- embeds
- components
- stickers
- attachments
Since only one of these is required - all parameters are optional on the RespondAsync
/any other method that sends a message. While it may be confusing at first, the exception message actually explains describes what's caused the issue.
Make sure to also log logMessage.Exception
so it gives you a better idea of what's went wrong.
Okay thanks I found out that i need to use DeferAsync