diff --git a/X10D.DSharpPlus/src/DiscordEmbedBuilderExtensions.cs b/X10D.DSharpPlus/src/DiscordEmbedBuilderExtensions.cs index fb21b85..e93c42b 100644 --- a/X10D.DSharpPlus/src/DiscordEmbedBuilderExtensions.cs +++ b/X10D.DSharpPlus/src/DiscordEmbedBuilderExtensions.cs @@ -7,6 +7,34 @@ namespace X10D.DSharpPlus; /// public static class DiscordEmbedBuilderExtensions { + /// + /// Adds a field of any value type to the embed. + /// + /// The to modify. + /// The name of the embed field. + /// The value of the embed field. + /// to display this field inline; otherwise, . + /// The type of . + /// The current instance of ; that is, . + /// is . + public static DiscordEmbedBuilder AddField( + this DiscordEmbedBuilder builder, + string name, + T? value, + bool inline = false) + { +#if NET6_0_OR_GREATER + ArgumentNullException.ThrowIfNull(builder); +#else + if (builder is null) + { + throw new ArgumentNullException(nameof(builder)); + } +#endif + + return builder.AddField(name, value?.ToString(), inline); + } + /// /// Conditionally adds a field to the embed. ///