pub struct MessageBuilder { /* private fields */ }Expand description
Builds a Message from styled spans.
Formatting is expressed as Telegram entities rather than as parse_mode
markup, which means interpolated text is never parsed and therefore never
needs escaping. A filename, a username, or an arbitrary error string can be
passed straight through with no sanitizing step.
Implementations§
Source§impl MessageBuilder
impl MessageBuilder
Sourcepub fn styled(self, text: impl AsRef<str>, style: Style) -> Self
pub fn styled(self, text: impl AsRef<str>, style: Style) -> Self
Appends text carrying an arbitrary combination of inline styles.
Sourcepub fn strikethrough(self, text: impl AsRef<str>) -> Self
pub fn strikethrough(self, text: impl AsRef<str>) -> Self
Appends struck-through text.
Sourcepub fn link(self, text: impl AsRef<str>, url: impl Into<String>) -> Self
pub fn link(self, text: impl AsRef<str>, url: impl Into<String>) -> Self
Appends text which links to a URL.
Sourcepub fn mention(self, text: impl AsRef<str>, user_id: i64) -> Self
pub fn mention(self, text: impl AsRef<str>, user_id: i64) -> Self
Appends a mention of a user who has no username.
Sourcepub fn custom_emoji(
self,
text: impl AsRef<str>,
custom_emoji_id: impl Into<String>,
) -> Self
pub fn custom_emoji( self, text: impl AsRef<str>, custom_emoji_id: impl Into<String>, ) -> Self
Appends an inline custom emoji sticker.
Sourcepub fn pre(self, text: impl AsRef<str>, language: Option<&str>) -> Self
pub fn pre(self, text: impl AsRef<str>, language: Option<&str>) -> Self
Appends a preformatted block, optionally tagged with a language.
Only available at the top level: Telegram does not permit pre to be
nested inside other entities.
Sourcepub fn blockquote(
self,
build: impl FnOnce(InlineBuilder) -> InlineBuilder,
) -> Self
pub fn blockquote( self, build: impl FnOnce(InlineBuilder) -> InlineBuilder, ) -> Self
Appends a block quotation containing inline-formatted content.
Sourcepub fn expandable_blockquote(
self,
build: impl FnOnce(InlineBuilder) -> InlineBuilder,
) -> Self
pub fn expandable_blockquote( self, build: impl FnOnce(InlineBuilder) -> InlineBuilder, ) -> Self
Appends a block quotation which is collapsed by default.
Sourcepub fn photo(self, source: FileSource) -> Self
pub fn photo(self, source: FileSource) -> Self
Attaches a photo, making the accumulated text its caption.
Sourcepub fn document(self, source: FileSource) -> Self
pub fn document(self, source: FileSource) -> Self
Attaches a document, making the accumulated text its caption.
Sourcepub const fn disable_notification(self, disable: bool) -> Self
pub const fn disable_notification(self, disable: bool) -> Self
Delivers the message silently, without a notification sound.
Sourcepub const fn protect_content(self, protect: bool) -> Self
pub const fn protect_content(self, protect: bool) -> Self
Prevents the message from being forwarded or saved.
Sourcepub const fn disable_link_preview(self, disable: bool) -> Self
pub const fn disable_link_preview(self, disable: bool) -> Self
Controls whether a link in the message generates a preview card.
Sourcepub const fn message_thread_id(self, thread_id: i64) -> Self
pub const fn message_thread_id(self, thread_id: i64) -> Self
Targets a specific topic within a forum chat.
Sourcepub const fn reply_to_message_id(self, message_id: i64) -> Self
pub const fn reply_to_message_id(self, message_id: i64) -> Self
Sends the message as a reply to an existing one.
Trait Implementations§
Source§impl Clone for MessageBuilder
impl Clone for MessageBuilder
Source§fn clone(&self) -> MessageBuilder
fn clone(&self) -> MessageBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more