Class EmbedFooterBuilder
- Namespace
- Discord
- Assembly
- Discord.Net.Core.dll
Represents a builder class for an embed footer.
public class EmbedFooterBuilder
- Inheritance
-
EmbedFooterBuilder
- 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
MaxFooterTextLength
Gets the maximum footer length allowed by Discord.
public const int MaxFooterTextLength = 2048
Field Value
Properties
IconUrl
Gets or sets the icon URL of the footer field.
public string IconUrl { get; set; }
Property Value
- string
The icon URL of the footer field.
Exceptions
- ArgumentException
Url is not a well-formed Uri.
Text
Gets or sets the footer text.
public string Text { get; set; }
Property Value
- string
The footer text.
Exceptions
- ArgumentException
Author name length is longer than MaxFooterTextLength.
Methods
Build()
Builds the footer field to be used.
public EmbedFooter Build()
Returns
Exceptions
- ArgumentException
Text length is longer than MaxFooterTextLength.
- or -
Equals(EmbedFooterBuilder)
Determines whether the specified EmbedFooterBuilder is equal to the current EmbedFooterBuilder
public bool Equals(EmbedFooterBuilder embedFooterBuilder)
Parameters
embedFooterBuilder
EmbedFooterBuilderThe EmbedFooterBuilder to compare with the current EmbedFooterBuilder
Returns
Equals(object)
Determines whether the specified object is equal to the current EmbedFooterBuilder.
public override bool Equals(object obj)
Parameters
obj
objectThe object to compare with the current EmbedFooterBuilder
Returns
Remarks
If the object passes is an EmbedFooterBuilder, Equals(EmbedFooterBuilder) 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 footer field.
public EmbedFooterBuilder WithIconUrl(string iconUrl)
Parameters
iconUrl
stringThe icon URL of the footer field.
Returns
- EmbedFooterBuilder
The current builder.
WithText(string)
Sets the name of the footer field.
public EmbedFooterBuilder WithText(string text)
Parameters
text
stringThe text of the footer field.
Returns
- EmbedFooterBuilder
The current builder.
Operators
operator ==(EmbedFooterBuilder, EmbedFooterBuilder)
public static bool operator ==(EmbedFooterBuilder left, EmbedFooterBuilder right)
Parameters
left
EmbedFooterBuilderright
EmbedFooterBuilder
Returns
operator !=(EmbedFooterBuilder, EmbedFooterBuilder)
public static bool operator !=(EmbedFooterBuilder left, EmbedFooterBuilder right)
Parameters
left
EmbedFooterBuilderright
EmbedFooterBuilder