diff --git a/src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs b/src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs index 384be196b7..a0aab86369 100644 --- a/src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs +++ b/src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs @@ -99,7 +99,9 @@ public static async Task ModifyAsync(ulong channelId, ulong msgId, BaseDi } else { - var apiArgs = new UploadFileParams(args.Attachments.Value.ToArray()) + var attachments = args.Attachments.Value?.ToArray() ?? Array.Empty(); + + var apiArgs = new UploadFileParams(attachments) { Content = args.Content, Embeds = apiEmbeds?.ToArray() ?? Optional.Unspecified, diff --git a/src/Discord.Net.WebSocket/Entities/Interaction/MessageComponents/SocketMessageComponent.cs b/src/Discord.Net.WebSocket/Entities/Interaction/MessageComponents/SocketMessageComponent.cs index 8758b98788..6691bc6e1d 100644 --- a/src/Discord.Net.WebSocket/Entities/Interaction/MessageComponents/SocketMessageComponent.cs +++ b/src/Discord.Net.WebSocket/Entities/Interaction/MessageComponents/SocketMessageComponent.cs @@ -286,7 +286,9 @@ public async Task UpdateAsync(Action func, RequestOptions opt } else { - var response = new API.Rest.UploadInteractionFileParams(args.Attachments.Value.ToArray()) + var attachments = args.Attachments.Value?.ToArray() ?? Array.Empty(); + + var response = new API.Rest.UploadInteractionFileParams(attachments) { Type = InteractionResponseType.UpdateMessage, Content = args.Content, diff --git a/src/Discord.Net.Webhook/WebhookClientHelper.cs b/src/Discord.Net.Webhook/WebhookClientHelper.cs index 535d0fb861..373c6f4208 100644 --- a/src/Discord.Net.Webhook/WebhookClientHelper.cs +++ b/src/Discord.Net.Webhook/WebhookClientHelper.cs @@ -109,7 +109,9 @@ await client.ApiClient.ModifyWebhookMessageAsync(client.Webhook.Id, messageId, a } else { - var apiArgs = new UploadWebhookFileParams(args.Attachments.Value.ToArray()) + var attachments = args.Attachments.Value?.ToArray() ?? Array.Empty(); + + var apiArgs = new UploadWebhookFileParams(attachments) { Content = args.Content.IsSpecified ? args.Content.Value : Optional.Create(), Embeds =