Use .setup_ctrlc_handler() in the examples

This commit is contained in:
Hirrolot 2022-02-03 16:34:40 +06:00
parent f97d699f74
commit 3307a0915c
7 changed files with 7 additions and 3 deletions

View file

@ -127,7 +127,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
.branch(Update::filter_callback_query().endpoint(callback_handler))
.branch(Update::filter_inline_query().endpoint(inline_query_handler));
DispatcherBuilder::new(bot, handler).build().dispatch().await;
DispatcherBuilder::new(bot, handler).build().setup_ctrlc_handler().dispatch().await;
log::info!("Closing bot... Goodbye!");

View file

@ -54,6 +54,7 @@ async fn main() {
)
.dependencies(dptree::deps![InMemStorage::<State>::new()])
.build()
.setup_ctrlc_handler()
.dispatch()
.await;
}

View file

@ -100,6 +100,7 @@ async fn main() {
"Error has occurred in the dispatcher",
))
.build()
.setup_ctrlc_handler()
.dispatch()
.await;
}

View file

@ -60,5 +60,5 @@ async fn main() {
},
));
DispatcherBuilder::new(bot, handler).build().dispatch().await;
DispatcherBuilder::new(bot, handler).build().setup_ctrlc_handler().dispatch().await;
}

View file

@ -50,6 +50,7 @@ async fn main() {
DispatcherBuilder::new(bot, handler)
.dependencies(dptree::deps![storage])
.build()
.setup_ctrlc_handler()
.dispatch()
.await;
}

View file

@ -25,5 +25,5 @@ async fn main() {
},
));
DispatcherBuilder::new(bot, handler).build().dispatch().await;
DispatcherBuilder::new(bot, handler).build().setup_ctrlc_handler().dispatch().await;
}

View file

@ -46,6 +46,7 @@ async fn main() {
DispatcherBuilder::new(bot, handler)
.dependencies(dptree::deps![storage])
.build()
.setup_ctrlc_handler()
.dispatch()
.await;
}