diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000000..cadefb93c4 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: + - package-ecosystem: cargo + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 diff --git a/lib/Cargo.toml b/lib/Cargo.toml index a6caf6a52e..5f1dc7dcc1 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -18,9 +18,10 @@ license = "MIT" openssl = ["hyper-tls"] rustls = ["hyper-rustls"] default = ["openssl"] + [dependencies] bytes = "0.5" -tokio = { version = "0.2", features = ["fs"]} +tokio = { version = "1.2", features = ["fs", "rt", "rt-multi-thread"] } tracing = "0.1.9" tracing-futures = "0.2" @@ -28,10 +29,11 @@ multipart = { version = "0.16", default-features = false, features = ["client"] telegram-bot-raw = { version = "0.8.0", path = "../raw" } -hyper = "0.13" -hyper-tls = { version = "0.4", optional = true } +hyper = { version = "0.14.4", features = ["http2", "client"] } +hyper-tls = { version = "0.5", optional = true } futures = "0.3" hyper-rustls = { version = "0.19", optional = true } + [dev-dependencies] -tracing-subscriber = "0.1.5" -tokio = { version = "0.2", features = ["macros", "time", "fs"] } +tracing-subscriber = "0.2.15" +tokio = { version = "1.2", features = ["macros", "time", "fs", "rt"] } diff --git a/lib/examples/features.rs b/lib/examples/features.rs index fe41ca12e8..b9e38b200a 100644 --- a/lib/examples/features.rs +++ b/lib/examples/features.rs @@ -4,7 +4,7 @@ use std::time::Duration; use futures::StreamExt; use telegram_bot::prelude::*; use telegram_bot::{Api, Error, Message, MessageKind, ParseMode, UpdateKind}; -use tokio::time::delay_for; +use tokio::time::sleep; async fn test_message(api: Api, message: Message) -> Result<(), Error> { api.send(message.text_reply("Simple message")).await?; @@ -46,11 +46,11 @@ async fn test_forward(api: Api, message: Message) -> Result<(), Error> { async fn test_edit_message(api: Api, message: Message) -> Result<(), Error> { let message1 = api.send(message.text_reply("Round 1")).await?; - delay_for(Duration::from_secs(2)).await; + sleep(Duration::from_secs(2)).await; let message2 = api.send(message1.edit_text("Round 2")).await?; - delay_for(Duration::from_secs(4)).await; + sleep(Duration::from_secs(4)).await; api.send(message2.edit_text("Round 3")).await?; Ok(()) diff --git a/lib/examples/live_location.rs b/lib/examples/live_location.rs index 7f4ecdae0c..f8748b03c5 100644 --- a/lib/examples/live_location.rs +++ b/lib/examples/live_location.rs @@ -3,7 +3,7 @@ use std::time::Duration; use futures::StreamExt; use telegram_bot::*; -use tokio::time::delay_for; +use tokio::time::sleep; const DELAY_DURATION: Duration = Duration::from_secs(2); @@ -12,13 +12,13 @@ async fn test(api: Api, message: Message) -> Result<(), Error> { .send(message.location_reply(0.0, 0.0).live_period(60)) .await?; - delay_for(DELAY_DURATION).await; + sleep(DELAY_DURATION).await; api.send(reply.edit_live_location(10.0, 10.0)).await?; - delay_for(DELAY_DURATION).await; + sleep(DELAY_DURATION).await; api.send(reply.edit_live_location(20.0, 20.0)).await?; - delay_for(DELAY_DURATION).await; + sleep(DELAY_DURATION).await; api.send(reply.edit_live_location(30.0, 30.0)).await?; Ok(()) diff --git a/lib/examples/poll.rs b/lib/examples/poll.rs index 315230e8bf..139aa08298 100644 --- a/lib/examples/poll.rs +++ b/lib/examples/poll.rs @@ -2,7 +2,7 @@ use std::env; use std::time::Duration; use futures::StreamExt; -use tokio::time::delay_for; +use tokio::time::sleep; use telegram_bot::prelude::*; use telegram_bot::{ @@ -19,7 +19,7 @@ fn make_test_poll<'p>(message: Message) -> SendPoll<'p, 'p, 'p> { async fn send_and_stop_poll<'p>(api: Api, poll: SendPoll<'p, 'p, 'p>) -> Result<(), Error> { let poll_message = api.send(poll).await?; - delay_for(Duration::from_secs(10)).await; + sleep(Duration::from_secs(10)).await; api.send(poll_message.stop_poll()).await?; Ok(())