mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-03 17:52:12 +01:00
Merge pull request #689 from teloxide/simplify-repls-impl
Simplify the implementation of REPLs
Former-commit-id: 431cdd1abb
This commit is contained in:
commit
2f306fe488
2 changed files with 10 additions and 13 deletions
|
@ -91,16 +91,13 @@ pub async fn commands_repl_with_listener<'a, R, Cmd, H, L, ListenerE, E, Args>(
|
||||||
// commands. See <https://github.com/teloxide/teloxide/issues/557>.
|
// commands. See <https://github.com/teloxide/teloxide/issues/557>.
|
||||||
let ignore_update = |_upd| Box::pin(async {});
|
let ignore_update = |_upd| Box::pin(async {});
|
||||||
|
|
||||||
Dispatcher::builder(
|
Dispatcher::builder(bot, Update::filter_message().filter_command::<Cmd>().endpoint(handler))
|
||||||
bot,
|
.default_handler(ignore_update)
|
||||||
Update::filter_message().filter_command::<Cmd>().chain(dptree::endpoint(handler)),
|
.enable_ctrlc_handler()
|
||||||
)
|
.build()
|
||||||
.default_handler(ignore_update)
|
.dispatch_with_listener(
|
||||||
.enable_ctrlc_handler()
|
listener,
|
||||||
.build()
|
LoggingErrorHandler::with_custom_text("An error from the update listener"),
|
||||||
.dispatch_with_listener(
|
)
|
||||||
listener,
|
.await;
|
||||||
LoggingErrorHandler::with_custom_text("An error from the update listener"),
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ where
|
||||||
// messages. See <https://github.com/teloxide/teloxide/issues/557>.
|
// messages. See <https://github.com/teloxide/teloxide/issues/557>.
|
||||||
let ignore_update = |_upd| Box::pin(async {});
|
let ignore_update = |_upd| Box::pin(async {});
|
||||||
|
|
||||||
Dispatcher::builder(bot, Update::filter_message().chain(dptree::endpoint(handler)))
|
Dispatcher::builder(bot, Update::filter_message().endpoint(handler))
|
||||||
.default_handler(ignore_update)
|
.default_handler(ignore_update)
|
||||||
.enable_ctrlc_handler()
|
.enable_ctrlc_handler()
|
||||||
.build()
|
.build()
|
||||||
|
|
Loading…
Reference in a new issue