From a514c845cb7980841a69f6305b7fd93931dfff8f Mon Sep 17 00:00:00 2001 From: Hirrolot Date: Sat, 23 Apr 2022 22:56:45 +0600 Subject: [PATCH] Simplify `examples/purchase.rs` by sharing filters --- examples/purchase.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/purchase.rs b/examples/purchase.rs index bb0d7290..632f5979 100644 --- a/examples/purchase.rs +++ b/examples/purchase.rs @@ -56,16 +56,16 @@ async fn main() { dialogue::enter::, State, _>() .branch( Update::filter_message() - .chain(teloxide::handler![State::ReceiveFullName].endpoint(receive_full_name)), + .branch(teloxide::handler![State::ReceiveFullName].endpoint(receive_full_name)) + .branch(dptree::entry().filter_command::().endpoint(handle_command)) + .branch(dptree::endpoint(invalid_state)), ) .branch( Update::filter_callback_query().chain( teloxide::handler![State::ReceiveProductChoice { full_name }] .endpoint(receive_product_selection), ), - ) - .branch(Update::filter_message().filter_command::().endpoint(handle_command)) - .branch(Update::filter_message().endpoint(invalid_state)), + ), ) .dependencies(dptree::deps![InMemStorage::::new()]) .build()