mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
Add CallbackQuery::regular_message
getter
This commit is contained in:
parent
a353439e3b
commit
0cb716a9ac
2 changed files with 10 additions and 7 deletions
|
@ -119,6 +119,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Other Changes
|
- 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 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 `RequestId` type
|
||||||
|
- Add `CallbackQuery::regular_message` getter
|
||||||
|
|
||||||
[pr851]: https://github.com/teloxide/teloxide/pull/851
|
[pr851]: https://github.com/teloxide/teloxide/pull/851
|
||||||
[pr887]: https://github.com/teloxide/teloxide/pull/887
|
[pr887]: https://github.com/teloxide/teloxide/pull/887
|
||||||
|
|
|
@ -60,13 +60,15 @@ impl CallbackQuery {
|
||||||
use crate::util::flatten;
|
use crate::util::flatten;
|
||||||
use std::iter::once;
|
use std::iter::once;
|
||||||
|
|
||||||
once(&self.from).chain(flatten(
|
once(&self.from).chain(flatten(self.regular_message().map(Message::mentioned_users)))
|
||||||
self.message
|
}
|
||||||
.as_ref()
|
|
||||||
// If we can access the message
|
#[must_use]
|
||||||
.and_then(|maybe| maybe.message())
|
pub fn regular_message(&self) -> Option<&Message> {
|
||||||
.map(Message::mentioned_users),
|
self.message
|
||||||
))
|
.as_ref()
|
||||||
|
// If we can access the message
|
||||||
|
.and_then(|maybe| maybe.message())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue