Merge pull request #689 from teloxide/simplify-repls-impl

Simplify the implementation of REPLs
This commit is contained in:
Hirrolot 2022-07-24 15:58:56 +06:00 committed by GitHub
commit 431cdd1abb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 13 deletions

View file

@ -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>.
let ignore_update = |_upd| Box::pin(async {});
Dispatcher::builder(
bot,
Update::filter_message().filter_command::<Cmd>().chain(dptree::endpoint(handler)),
)
.default_handler(ignore_update)
.enable_ctrlc_handler()
.build()
.dispatch_with_listener(
listener,
LoggingErrorHandler::with_custom_text("An error from the update listener"),
)
.await;
Dispatcher::builder(bot, Update::filter_message().filter_command::<Cmd>().endpoint(handler))
.default_handler(ignore_update)
.enable_ctrlc_handler()
.build()
.dispatch_with_listener(
listener,
LoggingErrorHandler::with_custom_text("An error from the update listener"),
)
.await;
}

View file

@ -69,7 +69,7 @@ where
// messages. See <https://github.com/teloxide/teloxide/issues/557>.
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)
.enable_ctrlc_handler()
.build()