pub fn filter_command<C, Output>() -> Handler<'static, Output, DpHandlerDescription>Expand description
Returns a handler that accepts a parsed command C.
A call to this function is the same as dptree::entry().filter_command().
See HandlerExt::filter_command.
ยงDependency requirements
Examples found in repository?
examples/purchase.rs (line 65)
62fn schema() -> UpdateHandler<Box<dyn std::error::Error + Send + Sync + 'static>> {
63 use dptree::case;
64
65 let command_handler = teloxide::filter_command::<Command, _>()
66 .branch(
67 case![State::Start]
68 .branch(case![Command::Help].endpoint(help))
69 .branch(case![Command::Start].endpoint(start)),
70 )
71 .branch(case![Command::Cancel].endpoint(cancel));
72
73 let message_handler = Update::filter_message()
74 .branch(command_handler)
75 .branch(case![State::ReceiveFullName].endpoint(receive_full_name))
76 .branch(dptree::endpoint(invalid_state));
77
78 let callback_query_handler = Update::filter_callback_query().branch(
79 case![State::ReceiveProductChoice { full_name }].endpoint(receive_product_selection),
80 );
81
82 dialogue::enter::<Update, InMemStorage<State>, State, _>()
83 .branch(message_handler)
84 .branch(callback_query_handler)
85}