mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
Separate handlers in examples/purchase.rs
This commit is contained in:
parent
df0d13c42b
commit
e5aafe3245
1 changed files with 12 additions and 12 deletions
|
@ -61,21 +61,21 @@ async fn main() {
|
|||
)
|
||||
.branch(teloxide::handler![Command::Cancel].endpoint(cancel));
|
||||
|
||||
let message_handler = Update::filter_message()
|
||||
.branch(command_handler)
|
||||
.branch(teloxide::handler![State::ReceiveFullName].endpoint(receive_full_name))
|
||||
.branch(dptree::endpoint(invalid_state));
|
||||
|
||||
let callback_query_handler = Update::filter_callback_query().chain(
|
||||
teloxide::handler![State::ReceiveProductChoice { full_name }]
|
||||
.endpoint(receive_product_selection),
|
||||
);
|
||||
|
||||
Dispatcher::builder(
|
||||
bot,
|
||||
dialogue::enter::<Update, InMemStorage<State>, State, _>()
|
||||
.branch(
|
||||
Update::filter_message()
|
||||
.branch(command_handler)
|
||||
.branch(teloxide::handler![State::ReceiveFullName].endpoint(receive_full_name))
|
||||
.branch(dptree::endpoint(invalid_state)),
|
||||
)
|
||||
.branch(
|
||||
Update::filter_callback_query().chain(
|
||||
teloxide::handler![State::ReceiveProductChoice { full_name }]
|
||||
.endpoint(receive_product_selection),
|
||||
),
|
||||
),
|
||||
.branch(message_handler)
|
||||
.branch(callback_query_handler),
|
||||
)
|
||||
.dependencies(dptree::deps![InMemStorage::<State>::new()])
|
||||
.build()
|
||||
|
|
Loading…
Reference in a new issue