mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-03 17:52:12 +01:00
parent
760f843010
commit
744679419a
2 changed files with 14 additions and 15 deletions
|
@ -220,12 +220,11 @@ where
|
|||
Upd: GetChatId + Clone + Send + Sync + 'static,
|
||||
Output: Send + Sync + 'static,
|
||||
{
|
||||
dptree::entry()
|
||||
.chain(dptree::filter_map(|storage: Arc<S>, upd: Upd| {
|
||||
dptree::filter_map(|storage: Arc<S>, upd: Upd| {
|
||||
let chat_id = upd.chat_id()?;
|
||||
Some(Dialogue::new(storage, chat_id))
|
||||
}))
|
||||
.chain(dptree::filter_map_async(|dialogue: Dialogue<D, S>| async move {
|
||||
})
|
||||
.filter_map_async(|dialogue: Dialogue<D, S>| async move {
|
||||
match dialogue.get_or_default().await {
|
||||
Ok(dialogue) => Some(dialogue),
|
||||
Err(err) => {
|
||||
|
@ -233,5 +232,5 @@ where
|
|||
None
|
||||
}
|
||||
}
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
|
|
@ -88,8 +88,8 @@ where
|
|||
C: BotCommands + Send + Sync + 'static,
|
||||
Output: Send + Sync + 'static,
|
||||
{
|
||||
dptree::entry().chain(dptree::filter_map(move |message: Message, me: Me| {
|
||||
dptree::filter_map(move |message: Message, me: Me| {
|
||||
let bot_name = me.user.username.expect("Bots must have a username");
|
||||
message.text().and_then(|text| C::parse(text, &bot_name).ok())
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue