public static EmbedFieldBuilder CreateEmbedField(string name, string description, bool isInline = false)
{
if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(description)) return null;
return new EmbedFieldBuilder().WithName(name).WithValue(description).WithIsInline(isInline);
}
public static EmbedAuthorBuilder CreateEmbedAuthor(string iconUrl, string name)
{
if (string.IsNullOrEmpty(name)) return null;
EmbedAuthorBuilder author = new EmbedAuthorBuilder().WithName(name);
if (!string.IsNullOrEmpty(iconUrl)) author.WithIconUrl(iconUrl);
return author;
}
public static EmbedBuilder CreateEmbed(string title = null, string description = null, string url = null, string imageUrl = null, EmbedAuthorBuilder author = null, IEnumerable<EmbedFieldBuilder> fields = null, DateTimeOffset? timestamp = null, byte colorRed = 0, byte colorGreen = 0, byte colorBlue = 0)
{
EmbedBuilder embed = new EmbedBuilder();
if (!string.IsNullOrEmpty(title)) embed.WithTitle(title);
if (!string.IsNullOrEmpty(description)) embed.WithDescription(description);
if (author != null) embed.WithAuthor(author);
if (fields != null && fields.Count() > 0) embed.WithFields(fields);
if (timestamp != null) embed.WithTimestamp((DateTimeOffset)timestamp);
if (!string.IsNullOrEmpty(url)) embed.WithUrl(url);
if (!string.IsNullOrEmpty(imageUrl)) embed.WithImageUrl(imageUrl);
embed.WithColor(colorRed, colorGreen, colorBlue);
return embed;
}