mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-24 23:57:38 +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));
|
.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(
|
Dispatcher::builder(
|
||||||
bot,
|
bot,
|
||||||
dialogue::enter::<Update, InMemStorage<State>, State, _>()
|
dialogue::enter::<Update, InMemStorage<State>, State, _>()
|
||||||
.branch(
|
.branch(message_handler)
|
||||||
Update::filter_message()
|
.branch(callback_query_handler),
|
||||||
.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),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
.dependencies(dptree::deps![InMemStorage::<State>::new()])
|
.dependencies(dptree::deps![InMemStorage::<State>::new()])
|
||||||
.build()
|
.build()
|
||||||
|
|
Loading…
Add table
Reference in a new issue