pub struct IncomingMessage {
pub raw: Message,
}Expand description
A new or edited message.
Fields§
§raw: MessageThe underlying TL message object.
Implementations§
Source§impl IncomingMessage
impl IncomingMessage
pub fn from_raw(raw: Message) -> Self
Sourcepub fn sender_id(&self) -> Option<&Peer>
pub fn sender_id(&self) -> Option<&Peer>
The sender peer, if available (not set for anonymous channel posts).
Sourcepub fn edit_date(&self) -> Option<i32>
pub fn edit_date(&self) -> Option<i32>
Unix timestamp of the last edit, if the message has been edited.
Sourcepub fn forward_count(&self) -> Option<i32>
pub fn forward_count(&self) -> Option<i32>
Number of times the message has been forwarded (channels only).
Sourcepub fn view_count(&self) -> Option<i32>
pub fn view_count(&self) -> Option<i32>
View count for channel posts.
Sourcepub fn reply_count(&self) -> Option<i32>
pub fn reply_count(&self) -> Option<i32>
Reply count (number of replies in a thread).
Sourcepub fn reply_to_message_id(&self) -> Option<i32>
pub fn reply_to_message_id(&self) -> Option<i32>
ID of the message this one is replying to.
Sourcepub async fn reply_to_message(
&self,
client: &Client,
) -> Result<Option<IncomingMessage>, Error>
pub async fn reply_to_message( &self, client: &Client, ) -> Result<Option<IncomingMessage>, Error>
Fetch the message that this one is replying to.
Returns None if this message is not a reply or if the peer is unknown.
Unlike reply_to_message_id this actually performs an API call to
retrieve the full message object.
Sourcepub fn date_utc(&self) -> Option<DateTime<Utc>>
pub fn date_utc(&self) -> Option<DateTime<Utc>>
The message’s send time as a chrono::DateTime<chrono::Utc>.
This is a typed wrapper around the raw date() Unix timestamp.
Sourcepub fn edit_date_utc(&self) -> Option<DateTime<Utc>>
pub fn edit_date_utc(&self) -> Option<DateTime<Utc>>
The last edit time as a chrono::DateTime<chrono::Utc>, if edited.
Sourcepub fn media(&self) -> Option<&MessageMedia>
pub fn media(&self) -> Option<&MessageMedia>
The media attached to this message, if any.
Sourcepub fn entities(&self) -> Option<&Vec<MessageEntity>>
pub fn entities(&self) -> Option<&Vec<MessageEntity>>
Formatting entities (bold, italic, code, links, etc).
Sourcepub fn grouped_id(&self) -> Option<i64>
pub fn grouped_id(&self) -> Option<i64>
Group ID for album messages (multiple media in one).
Sourcepub fn from_scheduled(&self) -> bool
pub fn from_scheduled(&self) -> bool
true if this message was sent from a scheduled one.
Sourcepub fn media_unread(&self) -> bool
pub fn media_unread(&self) -> bool
true if the media in this message has not been read yet.
Sourcepub fn via_bot_id(&self) -> Option<i64>
pub fn via_bot_id(&self) -> Option<i64>
ID of the bot that sent this message via inline mode, if any.
Signature of the post author in a channel, if set.
Sourcepub fn reaction_count(&self) -> i32
pub fn reaction_count(&self) -> i32
Number of reactions on this message, if any.
Sourcepub fn restriction_reason(&self) -> Option<&Vec<RestrictionReason>>
pub fn restriction_reason(&self) -> Option<&Vec<RestrictionReason>>
Restriction reasons (why this message is unavailable in some regions).
Sourcepub fn reply_markup(&self) -> Option<&ReplyMarkup>
pub fn reply_markup(&self) -> Option<&ReplyMarkup>
Reply markup (inline keyboards, etc).
Sourcepub fn forward_header(&self) -> Option<&MessageFwdHeader>
pub fn forward_header(&self) -> Option<&MessageFwdHeader>
Forward info header, if this message was forwarded.
Sourcepub fn noforwards(&self) -> bool
pub fn noforwards(&self) -> bool
true if forwarding this message is restricted.
Sourcepub fn markdown_text(&self) -> Option<String>
pub fn markdown_text(&self) -> Option<String>
Reconstruct Markdown from the message text and its formatting entities.
Returns plain text if there are no entities.
Source§impl IncomingMessage
impl IncomingMessage
Sourcepub fn download_location(&self) -> Option<InputFileLocation>
pub fn download_location(&self) -> Option<InputFileLocation>
Get the download location for the media in this message, if any.
Trait Implementations§
Source§impl Clone for IncomingMessage
impl Clone for IncomingMessage
Source§fn clone(&self) -> IncomingMessage
fn clone(&self) -> IncomingMessage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for IncomingMessage
impl RefUnwindSafe for IncomingMessage
impl Send for IncomingMessage
impl Sync for IncomingMessage
impl Unpin for IncomingMessage
impl UnsafeUnpin for IncomingMessage
impl UnwindSafe for IncomingMessage
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