Skip to content

Commit

Permalink
Similar to PR discord-net#2742 but this now fixes the UpdateAsync att…
Browse files Browse the repository at this point in the history
…achments bug.
  • Loading branch information
supitsmike committed Aug 21, 2023
1 parent 171f95d commit 4e16a43
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/Discord.Net.Rest/API/Common/InteractionCallbackData.cs
Expand Up @@ -30,5 +30,8 @@ internal class InteractionCallbackData

[JsonProperty("custom_id")]
public Optional<string> CustomId { get; set; }

[JsonProperty("attachments")]
public Optional<FileAttachment[]> Attachments { get; set; }
}
}
Expand Up @@ -523,7 +523,8 @@ public async Task UpdateAsync(Action<MessageProperties> func, RequestOptions opt
Components = args.Components.IsSpecified
? args.Components.Value?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Array.Empty<API.ActionRowComponent>()
: Optional<API.ActionRowComponent[]>.Unspecified,
Flags = args.Flags.IsSpecified ? args.Flags.Value ?? Optional<MessageFlags>.Unspecified : Optional<MessageFlags>.Unspecified
Flags = args.Flags.IsSpecified ? args.Flags.Value ?? Optional<MessageFlags>.Unspecified : Optional<MessageFlags>.Unspecified,
Attachments = args.Attachments.Value?.ToArray() ?? Array.Empty<FileAttachment>()
}
};

Expand Down
Expand Up @@ -269,7 +269,8 @@ public async Task UpdateAsync(Action<MessageProperties> func, RequestOptions opt
Components = args.Components.IsSpecified
? args.Components.Value?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Array.Empty<API.ActionRowComponent>()
: Optional<API.ActionRowComponent[]>.Unspecified,
Flags = args.Flags.IsSpecified ? args.Flags.Value ?? Optional<MessageFlags>.Unspecified : Optional<MessageFlags>.Unspecified
Flags = args.Flags.IsSpecified ? args.Flags.Value ?? Optional<MessageFlags>.Unspecified : Optional<MessageFlags>.Unspecified,
Attachments = args.Attachments.Value?.ToArray() ?? Array.Empty<FileAttachment>()
}
};

Expand Down

0 comments on commit 4e16a43

Please sign in to comment.