Discord-Net-Labs/Discord.Net-Labs

Context.Interaction.RespondAsync throwing Object reference not set to an instance of an Object if no text is supplied

Closed this issue · 0 comments

Description

When calling RespondAsync() in an SocketInteractionContext and no text: "" is supplied in RespondAsync() it will throw Object reference not set to an instance of an object..
When supplying String.Empty for the text parameter it will not throw an exception

Stack trace:

Error -> Unknown : Object reference not set to an instance of an object.
   at Discord.Rest.MessageHelper.ParseTags(String text, IMessageChannel channel, IGuild guild, IReadOnlyCollection`1 userMentions) in D:\RiderProjects\REDACTED\Discord.Net.Labs\src\Discord.Net.Rest\Entities\Messages\MessageHelper.cs:line 267
   at Discord.Rest.RestUserMessage.Update(Message model) in D:\RiderProjects\REDACTED\Discord.Net.Labs\src\Discord.Net.Rest\Entities\Messages\RestUserMessage.cs:line 109
   at Discord.Rest.RestInteractionMessage.Update(InteractionResponse model, IDiscordInteraction interaction) in D:\RiderProjects\REDACTED\Discord.Net.Labs\src\Discord.Net.Rest\Entities\Messages\RestInteractionMessage.cs:line 44
   at Discord.Rest.RestInteractionMessage.Create(BaseDiscordClient discord, InteractionResponse model, IDiscordInteraction interaction, IMessageChannel channel) in D:\RiderProjects\REDACTED\Discord.Net.Labs\src\Discord.Net.Rest\Entities\Messages\RestInteractionMessage.cs:line 32
   at Discord.Rest.InteractionHelper.SendInteractionResponseAsync(BaseDiscordClient client, InteractionResponse response, IDiscordInteraction interaction, IMessageChannel channel, RequestOptions options) in D:\RiderProjects\REDACTED\Discord.Net.Labs\src\Discord.Net.Rest\Entities\Interactions\InteractionHelper.cs:line 41
   at Discord.WebSocket.SocketCommandBase.RespondAsync(String text, Embed[] embeds, Boolean isTTS, Boolean ephemeral, AllowedMentions allowedMentions, MessageComponent component, Embed embed, RequestOptions options) in D:\RiderProjects\REDACTED\Discord.Net.Labs\src\Discord.Net.WebSocket\Entities\Interaction\SocketBaseCommand\SocketCommandBase.cs:line 136
   
   at Discord.Interactions.Builders.ModuleClassBuilder.<>c__DisplayClass10_0.<<CreateCallback>g__ExecuteCallback|1>d.MoveNext() in D:\RiderProjects\REDACTED\Discord.Net.Labs\src\Discord.Net.Interactions\Builders\ModuleClassBuilder.cs:line 323

Steps to reproduce

  • Use the Interactivity Framework and create a module under the SocketInteractionContext
  • Create any slash command
  • Respond to a slash command only with an embed and no text e.G await RespondAsync(embed: ...)