mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 06:25:10 +01:00
Add reply_to_story
field to MessageCommon
also add `reply_to_story` getter to `Message` struct and `filter_reply_to_story` filter to `MessageFilterExt`
This commit is contained in:
parent
4905758a78
commit
7e4d29cf15
3 changed files with 14 additions and 1 deletions
|
@ -128,6 +128,9 @@ pub struct MessageCommon {
|
|||
/// the message
|
||||
pub quote: Option<TextQuote>,
|
||||
|
||||
/// For replies to a story, the original story
|
||||
pub reply_to_story: Option<Story>,
|
||||
|
||||
/// If the sender of the message boosted the chat, the number of boosts
|
||||
/// added by the user
|
||||
pub sender_boost_count: Option<u16>,
|
||||
|
@ -704,7 +707,7 @@ mod getters {
|
|||
MessageInvoice, MessageLeftChatMember, MessageNewChatMembers, MessageNewChatPhoto,
|
||||
MessageNewChatTitle, MessageOrigin, MessagePassportData, MessagePinned,
|
||||
MessageProximityAlertTriggered, MessageSuccessfulPayment, MessageSupergroupChatCreated,
|
||||
MessageUsersShared, MessageVideoChatParticipantsInvited, PhotoSize, TextQuote, User,
|
||||
MessageUsersShared, MessageVideoChatParticipantsInvited, PhotoSize, Story, TextQuote, User,
|
||||
};
|
||||
|
||||
use super::{
|
||||
|
@ -758,6 +761,14 @@ mod getters {
|
|||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn reply_to_story(&self) -> Option<&Story> {
|
||||
match &self.kind {
|
||||
Common(MessageCommon { reply_to_story, .. }) => reply_to_story.as_ref(),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn forward_date(&self) -> Option<DateTime<Utc>> {
|
||||
self.forward_origin().map(|f| f.date())
|
||||
|
|
|
@ -548,6 +548,7 @@ mod test {
|
|||
forward_origin: None,
|
||||
external_reply: None,
|
||||
quote: None,
|
||||
reply_to_story: None,
|
||||
sender_boost_count: None,
|
||||
edit_date: None,
|
||||
media_kind: MediaKind::Text(MediaText {
|
||||
|
|
|
@ -96,6 +96,7 @@ define_message_ext! {
|
|||
(filter_migration_to, Message::migrate_to_chat_id),
|
||||
(filter_reply_to_message, Message::reply_to_message),
|
||||
(filter_forward_origin, Message::forward_origin),
|
||||
(filter_reply_to_story, Message::reply_to_story),
|
||||
// Rest variants of a MessageKind
|
||||
(filter_new_chat_members, Message::new_chat_members),
|
||||
(filter_left_chat_member, Message::left_chat_member),
|
||||
|
|
Loading…
Reference in a new issue