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

Returns

EmbedBuilder

EmbedBuilder

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>

Returns

EmbedBuilder

EmbedBuilder

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
value object
inline bool

Returns

EmbedBuilder

EmbedBuilder

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

Returns

EmbedBuilder

EmbedBuilder

WithAuthor(Action<EmbedAuthorBuilder>)

Sets the author field of the embed using an action.

public EmbedBuilder WithAuthor(Action<EmbedAuthorBuilder> action)

Parameters

action Action<EmbedAuthorBuilder>

Returns

EmbedBuilder

EmbedBuilder

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
iconUrl string
url string

Returns

EmbedBuilder

EmbedBuilder

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
g byte
b byte

Returns

EmbedBuilder

EmbedBuilder

WithColor(int)

Sets the color of the embed.

public EmbedBuilder WithColor(int color)

Parameters

color int

Returns

EmbedBuilder

EmbedBuilder

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

Returns

EmbedBuilder

EmbedBuilder

WithFooter(EmbedFooterBuilder)

Sets the footer field of the embed.

public EmbedBuilder WithFooter(EmbedFooterBuilder footer)

Parameters

footer EmbedFooterBuilder

Returns

EmbedBuilder

EmbedBuilder

WithFooter(Action<EmbedFooterBuilder>)

Sets the footer field of the embed using an action.

public EmbedBuilder WithFooter(Action<EmbedFooterBuilder> action)

Parameters

action Action<EmbedFooterBuilder>

Returns

EmbedBuilder

EmbedBuilder

WithFooter(string, string?)

Sets the footer field of the embed.

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

Parameters

text string
iconUrl string

Returns

EmbedBuilder

EmbedBuilder

WithImageUrl(string?)

Sets the image URL of the embed.

public EmbedBuilder WithImageUrl(string? imageUrl)

Parameters

imageUrl string

Returns

EmbedBuilder

EmbedBuilder

WithThumbnailUrl(string?)

Sets the thumbnail URL of the embed.

public EmbedBuilder WithThumbnailUrl(string? thumbnailUrl)

Parameters

thumbnailUrl string

Returns

EmbedBuilder

EmbedBuilder

WithTimestamp(DateTimeOffset)

Sets the timestamp of the embed.

public EmbedBuilder WithTimestamp(DateTimeOffset timestamp)

Parameters

timestamp DateTimeOffset

Returns

EmbedBuilder

EmbedBuilder

WithTitle(string?)

Sets the title of the embed.

public EmbedBuilder WithTitle(string? title)

Parameters

title string

Returns

EmbedBuilder

EmbedBuilder

WithUrl(string?)

Sets the URL of the embed.

public EmbedBuilder WithUrl(string? url)

Parameters

url string

Returns

EmbedBuilder

EmbedBuilder