[Fix] Additional Update/Modify Async Attachment's (#2753)

This commit is contained in:
Declan Messer
2023-08-21 23:27:23 +03:00
committed by GitHub
parent 171f95d49c
commit ae275ab3a7
3 changed files with 9 additions and 3 deletions

View File

@@ -99,7 +99,9 @@ namespace Discord.Rest
} }
else else
{ {
var apiArgs = new UploadFileParams(args.Attachments.Value.ToArray()) var attachments = args.Attachments.Value?.ToArray() ?? Array.Empty<FileAttachment>();
var apiArgs = new UploadFileParams(attachments)
{ {
Content = args.Content, Content = args.Content,
Embeds = apiEmbeds?.ToArray() ?? Optional<API.Embed[]>.Unspecified, Embeds = apiEmbeds?.ToArray() ?? Optional<API.Embed[]>.Unspecified,

View File

@@ -286,7 +286,9 @@ namespace Discord.WebSocket
} }
else else
{ {
var response = new API.Rest.UploadInteractionFileParams(args.Attachments.Value.ToArray()) var attachments = args.Attachments.Value?.ToArray() ?? Array.Empty<FileAttachment>();
var response = new API.Rest.UploadInteractionFileParams(attachments)
{ {
Type = InteractionResponseType.UpdateMessage, Type = InteractionResponseType.UpdateMessage,
Content = args.Content, Content = args.Content,

View File

@@ -109,7 +109,9 @@ namespace Discord.Webhook
} }
else else
{ {
var apiArgs = new UploadWebhookFileParams(args.Attachments.Value.ToArray()) var attachments = args.Attachments.Value?.ToArray() ?? Array.Empty<FileAttachment>();
var apiArgs = new UploadWebhookFileParams(attachments)
{ {
Content = args.Content.IsSpecified ? args.Content.Value : Optional.Create<string>(), Content = args.Content.IsSpecified ? args.Content.Value : Optional.Create<string>(),
Embeds = Embeds =