Class EmbedBuilder
- Namespace
- Fluxer.Net
- Assembly
- Fluxer.Net.dll
A builder for creating rich embeds with validation and a fluent API. Based on Fluxer.Net's EmbedBuilder implementation.
public class EmbedBuilder
- Inheritance
-
objectEmbedBuilder
Properties
Author
Gets or sets the author field of the embed.
public EmbedAuthorBuilder? Author { get; set; }
Property Value
Color
Gets or sets the color of the embed.
public int? Color { get; set; }
Property Value
- int?
Description
Gets or sets the description of the embed.
public string? Description { get; set; }
Property Value
Exceptions
- ArgumentException
Description length exceeds MaxDescriptionLength.
Fields
Gets the list of field builders for the embed.
public List<EmbedFieldBuilder> Fields { get; set; }
Property Value
Footer
Gets or sets the footer field of the embed.
public EmbedFooterBuilder? Footer { get; set; }
Property Value
ImageUrl
Gets or sets the image URL of the embed.
public string? ImageUrl { get; set; }
Property Value
Length
Gets the total length of all embed content.
public int Length { get; }
Property Value
MaxDescriptionLength
Maximum length of the description.
public static int MaxDescriptionLength { get; }
Property Value
MaxEmbedLength
Maximum total length of all embed content.
public static int MaxEmbedLength { get; }
Property Value
MaxFieldCount
Maximum number of fields allowed in an embed.
public static int MaxFieldCount { get; }
Property Value
MaxTitleLength
Maximum length of the title.
public static int MaxTitleLength { get; }
Property Value
ThumbnailUrl
Gets or sets the thumbnail URL of the embed.
public string? ThumbnailUrl { get; set; }
Property Value
Timestamp
Gets or sets the timestamp of the embed.
public DateTimeOffset? Timestamp { get; set; }
Property Value
Title
Gets or sets the title of the embed.
public string? Title { get; set; }
Property Value
Exceptions
- ArgumentException
Title length exceeds MaxTitleLength.
Url
Gets or sets the URL of the embed.
public string? Url { get; set; }
Property Value
Methods
AddField(EmbedFieldBuilder)
Adds a field to the embed.
public EmbedBuilder AddField(EmbedFieldBuilder field)
Parameters
fieldEmbedFieldBuilder
Returns
Exceptions
- ArgumentException
Field count exceeds MaxFieldCount.
AddField(Action<EmbedFieldBuilder>)
Adds a field to the embed using an action.
public EmbedBuilder AddField(Action<EmbedFieldBuilder> action)
Parameters
actionAction<EmbedFieldBuilder>
Returns
Exceptions
- ArgumentException
Field count exceeds MaxFieldCount.
AddField(string, object, bool)
Adds a field to the embed.
public EmbedBuilder AddField(string name, object value, bool inline = false)
Parameters
Returns
Exceptions
- ArgumentException
Field count exceeds MaxFieldCount.
Build()
Builds the embed.
public EmbedRequest Build()
Returns
- EmbedRequest
A new Fluxer.Net.EmbedJson object.
Exceptions
- InvalidOperationException
The embed exceeds MaxEmbedLength.
WithAuthor(EmbedAuthorBuilder)
Sets the author field of the embed.
public EmbedBuilder WithAuthor(EmbedAuthorBuilder author)
Parameters
authorEmbedAuthorBuilder
Returns
WithAuthor(Action<EmbedAuthorBuilder>)
Sets the author field of the embed using an action.
public EmbedBuilder WithAuthor(Action<EmbedAuthorBuilder> action)
Parameters
actionAction<EmbedAuthorBuilder>
Returns
WithAuthor(string, string?, string?)
Sets the author field of the embed.
public EmbedBuilder WithAuthor(string name, string? iconUrl = null, string? url = null)
Parameters
Returns
WithColor(byte, byte, byte)
Sets the color of the embed using RGB values.
public EmbedBuilder WithColor(byte r, byte g, byte b)
Parameters
Returns
WithColor(int)
Sets the color of the embed.
public EmbedBuilder WithColor(int color)
Parameters
colorint
Returns
WithCurrentTimestamp()
Sets the timestamp of the embed to the current UTC time.
public EmbedBuilder WithCurrentTimestamp()
Returns
- EmbedBuilder
The current builder.
WithDescription(string?)
Sets the description of the embed.
public EmbedBuilder WithDescription(string? description)
Parameters
descriptionstring
Returns
WithFooter(EmbedFooterBuilder)
Sets the footer field of the embed.
public EmbedBuilder WithFooter(EmbedFooterBuilder footer)
Parameters
footerEmbedFooterBuilder
Returns
WithFooter(Action<EmbedFooterBuilder>)
Sets the footer field of the embed using an action.
public EmbedBuilder WithFooter(Action<EmbedFooterBuilder> action)
Parameters
actionAction<EmbedFooterBuilder>
Returns
WithFooter(string, string?)
Sets the footer field of the embed.
public EmbedBuilder WithFooter(string text, string? iconUrl = null)
Parameters
Returns
WithImageUrl(string?)
Sets the image URL of the embed.
public EmbedBuilder WithImageUrl(string? imageUrl)
Parameters
imageUrlstring
Returns
WithThumbnailUrl(string?)
Sets the thumbnail URL of the embed.
public EmbedBuilder WithThumbnailUrl(string? thumbnailUrl)
Parameters
thumbnailUrlstring
Returns
WithTimestamp(DateTimeOffset)
Sets the timestamp of the embed.
public EmbedBuilder WithTimestamp(DateTimeOffset timestamp)
Parameters
timestampDateTimeOffset
Returns
WithTitle(string?)
Sets the title of the embed.
public EmbedBuilder WithTitle(string? title)
Parameters
titlestring
Returns
WithUrl(string?)
Sets the URL of the embed.
public EmbedBuilder WithUrl(string? url)
Parameters
urlstring