Skip to main content

Class EmbedBuilder

Represents a builder class for creating a Discord.EmbedType.Rich Discord.Embed.

Assembly: Discord.Net.Core.dll​
View Source​
Declaration
public class EmbedBuilder

Properties​

Title​

Gets or sets the title of an Discord.Embed.

View Source​
Declaration
public string Title { get; set; }

Description​

Gets or sets the description of an Discord.Embed.

View Source​
Declaration
public string Description { get; set; }

Url​

Gets or sets the URL of an Discord.Embed.

View Source​
Declaration
public string Url { get; set; }

ThumbnailUrl​

Gets or sets the thumbnail URL of an Discord.Embed.

View Source​
Declaration
public string ThumbnailUrl { get; set; }

ImageUrl​

Gets or sets the image URL of an Discord.Embed.

View Source​
Declaration
public string ImageUrl { get; set; }

Fields​

Gets or sets the list of Discord.EmbedFieldBuilder of an Discord.Embed.

View Source​
Declaration
public List<EmbedFieldBuilder> Fields { get; set; }

Timestamp​

Gets or sets the timestamp of an Discord.Embed.

View Source​
Declaration
public DateTimeOffset? Timestamp { get; set; }

Color​

Gets or sets the sidebar color of an Discord.Embed.

View Source​
Declaration
public Color? Color { get; set; }

Author​

Gets or sets the Discord.EmbedAuthorBuilder of an Discord.Embed.

View Source​
Declaration
public EmbedAuthorBuilder Author { get; set; }

Gets or sets the Discord.EmbedFooterBuilder of an Discord.Embed.

View Source​
Declaration
public EmbedFooterBuilder Footer { get; set; }

Length​

Gets the total length of all embed properties.

View Source​
Declaration
public int Length { get; }

Fields​

MaxFieldCount​

Returns the maximum number of fields allowed by Discord.

View Source​
Declaration
public const int MaxFieldCount = 25

MaxTitleLength​

Returns the maximum length of title allowed by Discord.

View Source​
Declaration
public const int MaxTitleLength = 256

MaxDescriptionLength​

Returns the maximum length of description allowed by Discord.

View Source​
Declaration
public const int MaxDescriptionLength = 4096

MaxEmbedLength​

Returns the maximum length of total characters allowed by Discord.

View Source​
Declaration
public const int MaxEmbedLength = 6000

Methods​

WithTitle(String)​

Sets the title of an Discord.Embed.

View Source​
Declaration
public EmbedBuilder WithTitle(string title)
Returns​

Discord.EmbedBuilder: The current builder.

Parameters​
TypeNameDescription
System.StringtitleThe title to be set.

WithDescription(String)​

Sets the description of an Discord.Embed.

View Source​
Declaration
public EmbedBuilder WithDescription(string description)
Returns​

Discord.EmbedBuilder: The current builder.

Parameters​
TypeNameDescription
System.StringdescriptionThe description to be set.

WithUrl(String)​

Sets the URL of an Discord.Embed.

View Source​
Declaration
public EmbedBuilder WithUrl(string url)
Returns​

Discord.EmbedBuilder: The current builder.

Parameters​
TypeNameDescription
System.StringurlThe URL to be set.

WithThumbnailUrl(String)​

Sets the thumbnail URL of an Discord.Embed.

View Source​
Declaration
public EmbedBuilder WithThumbnailUrl(string thumbnailUrl)
Returns​

Discord.EmbedBuilder: The current builder.

Parameters​
TypeNameDescription
System.StringthumbnailUrlThe thumbnail URL to be set.

WithImageUrl(String)​

Sets the image URL of an Discord.Embed.

View Source​
Declaration
public EmbedBuilder WithImageUrl(string imageUrl)
Returns​

Discord.EmbedBuilder: The current builder.

Parameters​
TypeNameDescription
System.StringimageUrlThe image URL to be set.

WithCurrentTimestamp()​

Sets the timestamp of an Discord.Embed to the current time.

View Source​
Declaration
public EmbedBuilder WithCurrentTimestamp()
Returns​

Discord.EmbedBuilder: The current builder.

WithTimestamp(DateTimeOffset)​

Sets the timestamp of an Discord.Embed.

View Source​
Declaration
public EmbedBuilder WithTimestamp(DateTimeOffset dateTimeOffset)
Returns​

Discord.EmbedBuilder: The current builder.

Parameters​
TypeNameDescription
System.DateTimeOffsetdateTimeOffsetThe timestamp to be set.

WithColor(Color)​

Sets the sidebar color of an Discord.Embed.

View Source​
Declaration
public EmbedBuilder WithColor(Color color)
Returns​

Discord.EmbedBuilder: The current builder.

Parameters​
TypeNameDescription
Discord.ColorcolorThe color to be set.

WithAuthor(EmbedAuthorBuilder)​

Sets the Discord.EmbedAuthorBuilder of an Discord.Embed.

View Source​
Declaration
public EmbedBuilder WithAuthor(EmbedAuthorBuilder author)
Returns​

Discord.EmbedBuilder: The current builder.

Parameters​
TypeNameDescription
Discord.EmbedAuthorBuilderauthorThe author builder class containing the author field properties.

WithAuthor(Action<EmbedAuthorBuilder>)​

Sets the author field of an Discord.Embed with the provided properties.

View Source​
Declaration
public EmbedBuilder WithAuthor(Action<EmbedAuthorBuilder> action)
Returns​

Discord.EmbedBuilder: The current builder.

Parameters​
TypeNameDescription
System.Action<Discord.EmbedAuthorBuilder>actionThe delegate containing the author field properties.

WithAuthor(String, String, String)​

Sets the author field of an Discord.Embed with the provided name, icon URL, and URL.

View Source​
Declaration
public EmbedBuilder WithAuthor(string name, string iconUrl = null, string url = null)
Returns​

Discord.EmbedBuilder: The current builder.

Parameters​
TypeNameDescription
System.StringnameThe title of the author field.
System.StringiconUrlThe icon URL of the author field.
System.StringurlThe URL of the author field.

WithFooter(EmbedFooterBuilder)​

Sets the Discord.EmbedFooterBuilder of an Discord.Embed.

View Source​
Declaration
public EmbedBuilder WithFooter(EmbedFooterBuilder footer)
Returns​

Discord.EmbedBuilder: The current builder.

Parameters​
TypeNameDescription
Discord.EmbedFooterBuilderfooterThe footer builder class containing the footer field properties.

WithFooter(Action<EmbedFooterBuilder>)​

Sets the footer field of an Discord.Embed with the provided properties.

View Source​
Declaration
public EmbedBuilder WithFooter(Action<EmbedFooterBuilder> action)
Returns​

Discord.EmbedBuilder: The current builder.

Parameters​
TypeNameDescription
System.Action<Discord.EmbedFooterBuilder>actionThe delegate containing the footer field properties.

WithFooter(String, String)​

Sets the footer field of an Discord.Embed with the provided name, icon URL.

View Source​
Declaration
public EmbedBuilder WithFooter(string text, string iconUrl = null)
Returns​

Discord.EmbedBuilder: The current builder.

Parameters​
TypeNameDescription
System.StringtextThe title of the footer field.
System.StringiconUrlThe icon URL of the footer field.

AddField(String, Object, Boolean)​

Adds an Discord.Embed field with the provided name and value.

View Source​
Declaration
public EmbedBuilder AddField(string name, object value, bool inline = false)
Returns​

Discord.EmbedBuilder: The current builder.

Parameters​
TypeNameDescription
System.StringnameThe title of the field.
System.ObjectvalueThe value of the field.
System.BooleaninlineIndicates whether the field is in-line or not.

AddField(EmbedFieldBuilder)​

Adds a field with the provided Discord.EmbedFieldBuilder to an Discord.Embed.

View Source​
Declaration
public EmbedBuilder AddField(EmbedFieldBuilder field)
Returns​

Discord.EmbedBuilder: The current builder.

Parameters​
TypeNameDescription
Discord.EmbedFieldBuilderfieldThe field builder class containing the field properties.

AddField(Action<EmbedFieldBuilder>)​

Adds an Discord.Embed field with the provided properties.

View Source​
Declaration
public EmbedBuilder AddField(Action<EmbedFieldBuilder> action)
Returns​

Discord.EmbedBuilder: The current builder.

Parameters​
TypeNameDescription
System.Action<Discord.EmbedFieldBuilder>actionThe delegate containing the field properties.

Build()​

Builds the Discord.Embed into a Rich Embed ready to be sent.

View Source​
Declaration
public Embed Build()
Returns​

Discord.Embed: The built embed object.

Extension Methods​

  • Discord.EmbedBuilder.Discord.EmbedBuilderExtensions.WithColor(System.UInt32)
  • Discord.EmbedBuilder.Discord.EmbedBuilderExtensions.WithColor(System.Byte,System.Byte,System.Byte)
  • Discord.EmbedBuilder.Discord.EmbedBuilderExtensions.WithColor(System.Int32,System.Int32,System.Int32)
  • Discord.EmbedBuilder.Discord.EmbedBuilderExtensions.WithColor(System.Single,System.Single,System.Single)
  • Discord.EmbedBuilder.Discord.EmbedBuilderExtensions.WithAuthor(Discord.IUser)
  • Discord.EmbedBuilder.Discord.EmbedBuilderExtensions.WithFields(System.Collections.Generic.IEnumerable{Discord.EmbedFieldBuilder})
  • Discord.EmbedBuilder.Discord.EmbedBuilderExtensions.WithFields(Discord.EmbedFieldBuilder[])