Table of Contents

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
object
EmbedBuilder

Properties

Author

Gets or sets the author field of the embed.

public EmbedAuthorBuilder? Author { get; set; }

Property Value

EmbedAuthorBuilder

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

string

Exceptions

ArgumentException

Description length exceeds MaxDescriptionLength.

Fields

Gets the list of field builders for the embed.

public List<EmbedFieldBuilder> Fields { get; set; }

Property Value

List<EmbedFieldBuilder>

Gets or sets the footer field of the embed.

public EmbedFooterBuilder? Footer { get; set; }

Property Value

EmbedFooterBuilder

ImageUrl

Gets or sets the image URL of the embed.

public string? ImageUrl { get; set; }

Property Value

string

Length

Gets the total length of all embed content.

public int Length { get; }

Property Value

int

MaxDescriptionLength

Maximum length of the description.

public static int MaxDescriptionLength { get; }

Property Value

int

MaxEmbedLength

Maximum total length of all embed content.

public static int MaxEmbedLength { get; }

Property Value

int

MaxFieldCount

Maximum number of fields allowed in an embed.

public static int MaxFieldCount { get; }

Property Value

int

MaxTitleLength

Maximum length of the title.

public static int MaxTitleLength { get; }

Property Value

int

ThumbnailUrl

Gets or sets the thumbnail URL of the embed.

public string? ThumbnailUrl { get; set; }

Property Value

string

Timestamp

Gets or sets the timestamp of the embed.

public DateTimeOffset? Timestamp { get; set; }

Property Value

DateTimeOffset?

Title

Gets or sets the title of the embed.

public string? Title { get; set; }

Property Value

string

Exceptions

ArgumentException

Title length exceeds MaxTitleLength.

Url

Gets or sets the URL of the embed.

public string? Url { get; set; }

Property Value

string

Methods

AddField(EmbedFieldBuilder)

Adds a field to the embed.

public EmbedBuilder AddField(EmbedFieldBuilder field)

Parameters

field EmbedFieldBuilder

The field builder to add.

Returns

EmbedBuilder

The current builder.

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

action Action<EmbedFieldBuilder>

The action to configure the field builder.

Returns

EmbedBuilder

The current builder.

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

name string

The name of the field.

value object

The value of the field.

inline bool

Whether the field should be inline.

Returns

EmbedBuilder

The current builder.

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

author EmbedAuthorBuilder

The author builder to set.

Returns

EmbedBuilder

The current builder.

WithAuthor(Action<EmbedAuthorBuilder>)

Sets the author field of the embed using an action.

public EmbedBuilder WithAuthor(Action<EmbedAuthorBuilder> action)

Parameters

action Action<EmbedAuthorBuilder>

The action to configure the author builder.

Returns

EmbedBuilder

The current builder.

WithAuthor(string, string?, string?)

Sets the author field of the embed.

public EmbedBuilder WithAuthor(string name, string? iconUrl = null, string? url = null)

Parameters

name string

The name of the author.

iconUrl string

The icon URL of the author.

url string

The URL of the author.

Returns

EmbedBuilder

The current builder.

WithColor(byte, byte, byte)

Sets the color of the embed using RGB values.

public EmbedBuilder WithColor(byte r, byte g, byte b)

Parameters

r byte

Red component (0-255).

g byte

Green component (0-255).

b byte

Blue component (0-255).

Returns

EmbedBuilder

The current builder.

WithColor(int)

Sets the color of the embed.

public EmbedBuilder WithColor(int color)

Parameters

color int

The color to set as an integer (RGB).

Returns

EmbedBuilder

The current builder.

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

description string

The description to set.

Returns

EmbedBuilder

The current builder.

WithFooter(EmbedFooterBuilder)

Sets the footer field of the embed.

public EmbedBuilder WithFooter(EmbedFooterBuilder footer)

Parameters

footer EmbedFooterBuilder

The footer builder to set.

Returns

EmbedBuilder

The current builder.

WithFooter(Action<EmbedFooterBuilder>)

Sets the footer field of the embed using an action.

public EmbedBuilder WithFooter(Action<EmbedFooterBuilder> action)

Parameters

action Action<EmbedFooterBuilder>

The action to configure the footer builder.

Returns

EmbedBuilder

The current builder.

WithFooter(string, string?)

Sets the footer field of the embed.

public EmbedBuilder WithFooter(string text, string? iconUrl = null)

Parameters

text string

The text of the footer.

iconUrl string

The icon URL of the footer.

Returns

EmbedBuilder

The current builder.

WithImageUrl(string?)

Sets the image URL of the embed.

public EmbedBuilder WithImageUrl(string? imageUrl)

Parameters

imageUrl string

The image URL to set.

Returns

EmbedBuilder

The current builder.

WithThumbnailUrl(string?)

Sets the thumbnail URL of the embed.

public EmbedBuilder WithThumbnailUrl(string? thumbnailUrl)

Parameters

thumbnailUrl string

The thumbnail URL to set.

Returns

EmbedBuilder

The current builder.

WithTimestamp(DateTimeOffset)

Sets the timestamp of the embed.

public EmbedBuilder WithTimestamp(DateTimeOffset timestamp)

Parameters

timestamp DateTimeOffset

The timestamp to set.

Returns

EmbedBuilder

The current builder.

WithTitle(string?)

Sets the title of the embed.

public EmbedBuilder WithTitle(string? title)

Parameters

title string

The title to set.

Returns

EmbedBuilder

The current builder.

WithUrl(string?)

Sets the URL of the embed.

public EmbedBuilder WithUrl(string? url)

Parameters

url string

The URL to set.

Returns

EmbedBuilder

The current builder.