Table of Contents

Class EmbedAuthorBuilder

Namespace
Discord
Assembly
Discord.Net.Core.dll

Represents a builder class for a author field.

public class EmbedAuthorBuilder
Inheritance
EmbedAuthorBuilder
Inherited Members

Examples

The example will build a rich embed with an author field, a footer field, and 2 normal fields using an EmbedBuilder:

var exampleAuthor = new EmbedAuthorBuilder()
        .WithName("I am a bot")
        .WithIconUrl("https://discord.com/assets/e05ead6e6ebc08df9291738d0aa6986d.png");
var exampleFooter = new EmbedFooterBuilder()
        .WithText("I am a nice footer")
        .WithIconUrl("https://discord.com/assets/28174a34e77bb5e5310ced9f95cb480b.png");
var exampleField = new EmbedFieldBuilder()
        .WithName("Title of Another Field")
        .WithValue("I am an [example](https://example.com).")
        .WithInline(true);
var otherField = new EmbedFieldBuilder()
        .WithName("Title of a Field")
        .WithValue("Notice how I'm inline with that other field next to me.")
        .WithInline(true);
var embed = new EmbedBuilder()
        .AddField(exampleField)
        .AddField(otherField)
        .WithAuthor(exampleAuthor)
        .WithFooter(exampleFooter)
        .Build();

Fields

MaxAuthorNameLength

Gets the maximum author name length allowed by Discord.

public const int MaxAuthorNameLength = 256

Field Value

int

Properties

IconUrl

Gets or sets the icon URL of the author field.

public string IconUrl { get; set; }

Property Value

string

The icon URL of the author field.

Exceptions

ArgumentException

Url is not a well-formed Uri.

Name

Gets or sets the author name.

public string Name { get; set; }

Property Value

string

The author name.

Exceptions

ArgumentException

Author name length is longer than MaxAuthorNameLength.

Url

Gets or sets the URL of the author field.

public string Url { get; set; }

Property Value

string

The URL of the author field.

Exceptions

ArgumentException

Url is not a well-formed Uri.

Methods

Build()

Builds the author field to be used.

public EmbedAuthor Build()

Returns

EmbedAuthor

The built author field.

Exceptions

ArgumentException

Author name length is longer than MaxAuthorNameLength.

- or -

Url is not a well-formed Uri.

- or -

IconUrl is not a well-formed Uri.

Equals(EmbedAuthorBuilder)

Determines whether the specified EmbedAuthorBuilder is equals to the current EmbedAuthorBuilder

public bool Equals(EmbedAuthorBuilder embedAuthorBuilder)

Parameters

embedAuthorBuilder EmbedAuthorBuilder

The EmbedAuthorBuilder to compare with the current EmbedAuthorBuilder

Returns

bool

Equals(object)

Determines whether the specified object is equal to the current EmbedAuthorBuilder.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current EmbedAuthorBuilder

Returns

bool

Remarks

If the object passes is an EmbedAuthorBuilder, Equals(EmbedAuthorBuilder) will be called to compare the 2 instances

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

WithIconUrl(string)

Sets the icon URL of the author field.

public EmbedAuthorBuilder WithIconUrl(string iconUrl)

Parameters

iconUrl string

The icon URL of the author field.

Returns

EmbedAuthorBuilder

The current builder.

WithName(string)

Sets the name of the author field.

public EmbedAuthorBuilder WithName(string name)

Parameters

name string

The name of the author field.

Returns

EmbedAuthorBuilder

The current builder.

WithUrl(string)

Sets the URL of the author field.

public EmbedAuthorBuilder WithUrl(string url)

Parameters

url string

The URL of the author field.

Returns

EmbedAuthorBuilder

The current builder.

Operators

operator ==(EmbedAuthorBuilder, EmbedAuthorBuilder)

public static bool operator ==(EmbedAuthorBuilder left, EmbedAuthorBuilder right)

Parameters

left EmbedAuthorBuilder
right EmbedAuthorBuilder

Returns

bool

operator !=(EmbedAuthorBuilder, EmbedAuthorBuilder)

public static bool operator !=(EmbedAuthorBuilder left, EmbedAuthorBuilder right)

Parameters

left EmbedAuthorBuilder
right EmbedAuthorBuilder

Returns

bool