Consistency

pull/1032/head
Tyrrrz 2 years ago
parent 36db99b5cf
commit 505330e117

@ -70,7 +70,7 @@ public partial record Embed
// with this by merging related embeds at the end of the message parsing process. // with this by merging related embeds at the end of the message parsing process.
// https://github.com/Tyrrrz/DiscordChatExporter/issues/695 // https://github.com/Tyrrrz/DiscordChatExporter/issues/695
var images = var images =
json.GetPropertyOrNull("image")?.Pipe(EmbedImage.Parse).Enumerate().ToArray() ?? json.GetPropertyOrNull("image")?.Pipe(EmbedImage.Parse).ToSingletonEnumerable().ToArray() ??
Array.Empty<EmbedImage>(); Array.Empty<EmbedImage>();
var video = json.GetPropertyOrNull("video")?.Pipe(EmbedVideo.Parse); var video = json.GetPropertyOrNull("video")?.Pipe(EmbedVideo.Parse);

@ -4,7 +4,7 @@ namespace DiscordChatExporter.Core.Utils.Extensions;
public static class CollectionExtensions public static class CollectionExtensions
{ {
public static IEnumerable<T> Enumerate<T>(this T obj) public static IEnumerable<T> ToSingletonEnumerable<T>(this T obj)
{ {
yield return obj; yield return obj;
} }

Loading…
Cancel
Save