pub struct EmbedFooterBuilder { /* private fields */ }Expand description
Builds the footer
of an embed — a text with an optional icon — for EmbedBuilder::footer.
A plain text converts into it, so .footer("Page 1") is enough when there is no icon.
EmbedBuilder::build checks it as part of the embed; build checks it on
its own.
discord.js counterpart: the EmbedFooterOptions passed to EmbedBuilder#setFooter.
§Examples
use djs_builders::{EmbedBuilder, EmbedFooterBuilder};
let embed = EmbedBuilder::new()
.footer(EmbedFooterBuilder::new("Powered by djs-rs").icon_url("https://example.com/i.png"))
.build()
.unwrap();
assert_eq!(embed.footer.unwrap().icon_url.as_deref(), Some("https://example.com/i.png"));Implementations§
Sourcepub fn new(text: impl Into<CompactString>) -> Self
pub fn new(text: impl Into<CompactString>) -> Self
Creates a footer with text (at most 2048 characters).
discord.js counterpart: the text of EmbedFooterOptions, given to EmbedBuilder#setFooter.
Sourcepub fn icon_url(self, url: impl Into<CompactString>) -> Self
pub fn icon_url(self, url: impl Into<CompactString>) -> Self
Sets the icon shown before the text: a link (http://, https://) or an uploaded
file (attachment://name.png).
discord.js counterpart: the iconURL of EmbedFooterOptions.
Sourcepub fn build(self) -> Result<EmbedFooter, ValidationError>
pub fn build(self) -> Result<EmbedFooter, ValidationError>
Checks the footer on its own and returns it; the paths in a ValidationError are
text and icon_url.
discord.js counterpart: EmbedFooterOptions, checked by EmbedBuilder#setFooter.
§Errors
ValidationError::TooLong for a text above 2048 characters,
ValidationError::InvalidUrl for an icon with a scheme Discord does not allow.
Sourcepub fn build_unchecked(self) -> EmbedFooter
pub fn build_unchecked(self) -> EmbedFooter
Returns the footer without any check (D-180).
discord.js counterpart: EmbedFooterOptions with validation off (disableValidators).