diff --git a/crates/teloxide-core/CHANGELOG.md b/crates/teloxide-core/CHANGELOG.md index 4ee5206a..34b7ec97 100644 --- a/crates/teloxide-core/CHANGELOG.md +++ b/crates/teloxide-core/CHANGELOG.md @@ -119,6 +119,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Other Changes - Add fields `ChafFullInfo::{has_visible_history, accent_color_id, background_custom_emoji_id, profile_accent_color_id, profile_background_custom_emoji_id}` - Add `RequestId` type + - Add `CallbackQuery::regular_message` getter [pr851]: https://github.com/teloxide/teloxide/pull/851 [pr887]: https://github.com/teloxide/teloxide/pull/887 diff --git a/crates/teloxide-core/src/types/callback_query.rs b/crates/teloxide-core/src/types/callback_query.rs index 511ac32e..a31d61d7 100644 --- a/crates/teloxide-core/src/types/callback_query.rs +++ b/crates/teloxide-core/src/types/callback_query.rs @@ -60,13 +60,15 @@ impl CallbackQuery { use crate::util::flatten; use std::iter::once; - once(&self.from).chain(flatten( - self.message - .as_ref() - // If we can access the message - .and_then(|maybe| maybe.message()) - .map(Message::mentioned_users), - )) + once(&self.from).chain(flatten(self.regular_message().map(Message::mentioned_users))) + } + + #[must_use] + pub fn regular_message(&self) -> Option<&Message> { + self.message + .as_ref() + // If we can access the message + .and_then(|maybe| maybe.message()) } }