From 07652a756596f8cbd71b5088bb8aa8c6b4342392 Mon Sep 17 00:00:00 2001 From: Hirrolot Date: Sun, 24 Jul 2022 14:53:28 +0600 Subject: [PATCH] Simplify the implementation of REPLs Former-commit-id: e7ad0e4c808a79cff37429f292ffbcde18221c8e --- src/dispatching/repls/commands_repl.rs | 21 +++++++++------------ src/dispatching/repls/repl.rs | 2 +- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/dispatching/repls/commands_repl.rs b/src/dispatching/repls/commands_repl.rs index 7f7db10f..6967dfa0 100644 --- a/src/dispatching/repls/commands_repl.rs +++ b/src/dispatching/repls/commands_repl.rs @@ -91,16 +91,13 @@ pub async fn commands_repl_with_listener<'a, R, Cmd, H, L, ListenerE, E, Args>( // commands. See . let ignore_update = |_upd| Box::pin(async {}); - Dispatcher::builder( - bot, - Update::filter_message().filter_command::().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::().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; } diff --git a/src/dispatching/repls/repl.rs b/src/dispatching/repls/repl.rs index cecf90ad..38a8093d 100644 --- a/src/dispatching/repls/repl.rs +++ b/src/dispatching/repls/repl.rs @@ -69,7 +69,7 @@ where // messages. See . 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()