Class EmbedBuilder
Represents a builder class for creating a Discord.EmbedType.Rich Discord.Embed.
Assembly: Discord.Net.Core.dll​
View Source​
public class EmbedBuilder
Properties​
Title​
Gets or sets the title of an Discord.Embed.
View Source​
public string Title { get; set; }
Description​
Gets or sets the description of an Discord.Embed.
View Source​
public string Description { get; set; }
Url​
Gets or sets the URL of an Discord.Embed.
View Source​
public string Url { get; set; }
ThumbnailUrl​
Gets or sets the thumbnail URL of an Discord.Embed.
View Source​
public string ThumbnailUrl { get; set; }
ImageUrl​
Gets or sets the image URL of an Discord.Embed.
View Source​
public string ImageUrl { get; set; }
Fields​
Gets or sets the list of Discord.EmbedFieldBuilder of an Discord.Embed.
View Source​
public List<EmbedFieldBuilder> Fields { get; set; }
Timestamp​
Gets or sets the timestamp of an Discord.Embed.
View Source​
public DateTimeOffset? Timestamp { get; set; }
Color​
Gets or sets the sidebar color of an Discord.Embed.
View Source​
public Color? Color { get; set; }
Author​
Gets or sets the Discord.EmbedAuthorBuilder of an Discord.Embed.
View Source​
public EmbedAuthorBuilder Author { get; set; }
Footer​
Gets or sets the Discord.EmbedFooterBuilder of an Discord.Embed.
View Source​
public EmbedFooterBuilder Footer { get; set; }
Length​
Gets the total length of all embed properties.
View Source​
public int Length { get; }
Fields​
MaxFieldCount​
Returns the maximum number of fields allowed by Discord.
View Source​
public const int MaxFieldCount = 25
MaxTitleLength​
Returns the maximum length of title allowed by Discord.
View Source​
public const int MaxTitleLength = 256
MaxDescriptionLength​
Returns the maximum length of description allowed by Discord.
View Source​
public const int MaxDescriptionLength = 4096
MaxEmbedLength​
Returns the maximum length of total characters allowed by Discord.
View Source​
public const int MaxEmbedLength = 6000
Methods​
WithTitle(String)​
Sets the title of an Discord.Embed.
View Source​
public EmbedBuilder WithTitle(string title)
Returns​
Discord.EmbedBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.String | title | The title to be set. |
WithDescription(String)​
Sets the description of an Discord.Embed.
View Source​
public EmbedBuilder WithDescription(string description)
Returns​
Discord.EmbedBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.String | description | The description to be set. |
WithUrl(String)​
Sets the URL of an Discord.Embed.
View Source​
public EmbedBuilder WithUrl(string url)
Returns​
Discord.EmbedBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.String | url | The URL to be set. |
WithThumbnailUrl(String)​
Sets the thumbnail URL of an Discord.Embed.
View Source​
public EmbedBuilder WithThumbnailUrl(string thumbnailUrl)
Returns​
Discord.EmbedBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.String | thumbnailUrl | The thumbnail URL to be set. |
WithImageUrl(String)​
Sets the image URL of an Discord.Embed.
View Source​
public EmbedBuilder WithImageUrl(string imageUrl)
Returns​
Discord.EmbedBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.String | imageUrl | The image URL to be set. |
WithCurrentTimestamp()​
Sets the timestamp of an Discord.Embed to the current time.
View Source​
public EmbedBuilder WithCurrentTimestamp()
Returns​
Discord.EmbedBuilder: The current builder.
WithTimestamp(DateTimeOffset)​
Sets the timestamp of an Discord.Embed.
View Source​
public EmbedBuilder WithTimestamp(DateTimeOffset dateTimeOffset)
Returns​
Discord.EmbedBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.DateTimeOffset | dateTimeOffset | The timestamp to be set. |
WithColor(Color)​
Sets the sidebar color of an Discord.Embed.
View Source​
public EmbedBuilder WithColor(Color color)
Returns​
Discord.EmbedBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
Discord.Color | color | The color to be set. |
WithAuthor(EmbedAuthorBuilder)​
Sets the Discord.EmbedAuthorBuilder of an Discord.Embed.
View Source​
public EmbedBuilder WithAuthor(EmbedAuthorBuilder author)
Returns​
Discord.EmbedBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
Discord.EmbedAuthorBuilder | author | The 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​
public EmbedBuilder WithAuthor(Action<EmbedAuthorBuilder> action)
Returns​
Discord.EmbedBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.Action<Discord.EmbedAuthorBuilder> | action | The 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​
public EmbedBuilder WithAuthor(string name, string iconUrl = null, string url = null)
Returns​
Discord.EmbedBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.String | name | The title of the author field. |
System.String | iconUrl | The icon URL of the author field. |
System.String | url | The URL of the author field. |
WithFooter(EmbedFooterBuilder)​
Sets the Discord.EmbedFooterBuilder of an Discord.Embed.
View Source​
public EmbedBuilder WithFooter(EmbedFooterBuilder footer)
Returns​
Discord.EmbedBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
Discord.EmbedFooterBuilder | footer | The 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​
public EmbedBuilder WithFooter(Action<EmbedFooterBuilder> action)
Returns​
Discord.EmbedBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.Action<Discord.EmbedFooterBuilder> | action | The 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​
public EmbedBuilder WithFooter(string text, string iconUrl = null)
Returns​
Discord.EmbedBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.String | text | The title of the footer field. |
System.String | iconUrl | The icon URL of the footer field. |
AddField(String, Object, Boolean)​
Adds an Discord.Embed field with the provided name and value.
View Source​
public EmbedBuilder AddField(string name, object value, bool inline = false)
Returns​
Discord.EmbedBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.String | name | The title of the field. |
System.Object | value | The value of the field. |
System.Boolean | inline | Indicates whether the field is in-line or not. |
AddField(EmbedFieldBuilder)​
Adds a field with the provided Discord.EmbedFieldBuilder to an Discord.Embed.
View Source​
public EmbedBuilder AddField(EmbedFieldBuilder field)
Returns​
Discord.EmbedBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
Discord.EmbedFieldBuilder | field | The field builder class containing the field properties. |
AddField(Action<EmbedFieldBuilder>)​
Adds an Discord.Embed field with the provided properties.
View Source​
public EmbedBuilder AddField(Action<EmbedFieldBuilder> action)
Returns​
Discord.EmbedBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.Action<Discord.EmbedFieldBuilder> | action | The delegate containing the field properties. |
Build()​
Builds the Discord.Embed into a Rich Embed ready to be sent.
View Source​
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[])