pub struct InputMessage {
pub text: String,
pub reply_to: Option<i32>,
pub silent: bool,
pub background: bool,
pub clear_draft: bool,
pub no_webpage: bool,
pub invert_media: bool,
pub schedule_once_online: bool,
pub entities: Option<Vec<MessageEntity>>,
pub reply_markup: Option<ReplyMarkup>,
pub schedule_date: Option<i32>,
pub media: Option<InputMedia>,
}Expand description
Builder for composing outgoing messages.
use layer_client::InputMessage;
let msg = InputMessage::text("Hello, *world*!")
.silent(true)
.reply_to(Some(42));Fields§
§text: String§reply_to: Option<i32>§silent: bool§background: bool§clear_draft: bool§no_webpage: bool§invert_media: boolShow media above the caption instead of below (Telegram ≥ 10.3).\
schedule_once_online: boolSchedule to send when the user goes online (schedule_date = 0x7FFFFFFE).\
entities: Option<Vec<MessageEntity>>§reply_markup: Option<ReplyMarkup>§schedule_date: Option<i32>§media: Option<InputMedia>Attached media to send alongside the message (G-45).
Use InputMessage::copy_media to attach media copied from an existing message.
Implementations§
Source§impl InputMessage
impl InputMessage
Sourcepub fn background(self, v: bool) -> Self
pub fn background(self, v: bool) -> Self
Send in background.
Sourcepub fn clear_draft(self, v: bool) -> Self
pub fn clear_draft(self, v: bool) -> Self
Clear the draft after sending.
Sourcepub fn no_webpage(self, v: bool) -> Self
pub fn no_webpage(self, v: bool) -> Self
Disable link preview.
Sourcepub fn invert_media(self, v: bool) -> Self
pub fn invert_media(self, v: bool) -> Self
Show media above the caption rather than below (requires Telegram ≥ 10.3).
Sourcepub fn schedule_once_online(self) -> Self
pub fn schedule_once_online(self) -> Self
Schedule the message to be sent when the recipient comes online.
Mutually exclusive with schedule_date — calling this last wins.
Uses the Telegram magic value 0x7FFFFFFE.
Sourcepub fn entities(self, e: Vec<MessageEntity>) -> Self
pub fn entities(self, e: Vec<MessageEntity>) -> Self
Attach formatting entities (bold, italic, code, links, etc).
Sourcepub fn reply_markup(self, rm: ReplyMarkup) -> Self
pub fn reply_markup(self, rm: ReplyMarkup) -> Self
Attach a reply markup (inline or reply keyboard).
Sourcepub fn keyboard(self, kb: impl Into<ReplyMarkup>) -> Self
pub fn keyboard(self, kb: impl Into<ReplyMarkup>) -> Self
Shorthand for attaching an crate::keyboard::InlineKeyboard.
use layer_client::{InputMessage, keyboard::{InlineKeyboard, Button}};
let msg = InputMessage::text("Pick one:")
.keyboard(InlineKeyboard::new()
.row([Button::callback("A", b"a"), Button::callback("B", b"b")]));Sourcepub fn schedule_date(self, ts: Option<i32>) -> Self
pub fn schedule_date(self, ts: Option<i32>) -> Self
Schedule the message for a future Unix timestamp.
Sourcepub fn copy_media(self, media: InputMedia) -> Self
pub fn copy_media(self, media: InputMedia) -> Self
Attach media copied from an existing message (G-45).
Pass the InputMedia obtained from crate::media::Photo,
crate::media::Document, or directly from a raw MessageMedia.
When a media is set, the message is sent via messages.SendMedia
instead of messages.SendMessage.
let msg = InputMessage::text("Here is the file again")
.copy_media(media);Sourcepub fn clear_media(self) -> Self
pub fn clear_media(self) -> Self
Remove any previously attached media.
Trait Implementations§
Source§impl Clone for InputMessage
impl Clone for InputMessage
Source§fn clone(&self) -> InputMessage
fn clone(&self) -> InputMessage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for InputMessage
impl Default for InputMessage
Source§fn default() -> InputMessage
fn default() -> InputMessage
Source§impl From<&str> for InputMessage
impl From<&str> for InputMessage
Auto Trait Implementations§
impl Freeze for InputMessage
impl RefUnwindSafe for InputMessage
impl Send for InputMessage
impl Sync for InputMessage
impl Unpin for InputMessage
impl UnsafeUnpin for InputMessage
impl UnwindSafe for InputMessage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more