pub struct TextDisplayBuilder { /* private fields */ }Expand description
Builds a text display: markdown text in a Components V2 message, a container or a section (1-4000 characters, not blank). All text displays of a message share 4000 characters (D-200).
Sections and containers also take text directly with .text("…") (D-204).
discord.js counterpart: TextDisplayBuilder.
§Examples
use djs_builders::TextDisplayBuilder;
let text = TextDisplayBuilder::new("## Release notes\n- faster cache").build().unwrap();
assert_eq!(text.kind(), djs_model::component::ComponentType::TextDisplay);Implementations§
Source§impl TextDisplayBuilder
impl TextDisplayBuilder
Sourcepub fn id(self, id: i32) -> Self
pub fn id(self, id: i32) -> Self
Sets the component’s numeric identifier (Discord generates one otherwise); it must be unique in the message or modal.
discord.js counterpart: setId.
Sourcepub fn build(self) -> Result<Component, ValidationError>
pub fn build(self) -> Result<Component, ValidationError>
Checks the component (and what it contains) and returns it.
discord.js counterpart: toJSON of the component builders.
§Errors
The first ValidationError found; see the type docs
for the rules.
Sourcepub fn build_unchecked(self) -> Component
pub fn build_unchecked(self) -> Component
Returns the component without any check (D-180).
discord.js counterpart: toJSON of the component builders with validation off (disableValidators).