Skip to content

Commit

Permalink
[Fix] Additional Update/Modify Async Attachment's (#2753)
Browse files Browse the repository at this point in the history
  • Loading branch information
DeclanFrampton committed Aug 21, 2023
1 parent 171f95d commit ae275ab
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ public static async Task<Model> ModifyAsync(ulong channelId, ulong msgId, BaseDi
}
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,
Embeds = apiEmbeds?.ToArray() ?? Optional<API.Embed[]>.Unspecified,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,9 @@ public async Task UpdateAsync(Action<MessageProperties> func, RequestOptions opt
}
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,
Content = args.Content,
Expand Down
4 changes: 3 additions & 1 deletion src/Discord.Net.Webhook/WebhookClientHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<FileAttachment>();

var apiArgs = new UploadWebhookFileParams(attachments)
{
Content = args.Content.IsSpecified ? args.Content.Value : Optional.Create<string>(),
Embeds =
Expand Down

0 comments on commit ae275ab

Please sign in to comment.