Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: cargo
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
12 changes: 7 additions & 5 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,22 @@ 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"
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"] }
6 changes: 3 additions & 3 deletions lib/examples/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;
Expand Down Expand Up @@ -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(())
Expand Down
8 changes: 4 additions & 4 deletions lib/examples/live_location.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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(())
Expand Down
4 changes: 2 additions & 2 deletions lib/examples/poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand All @@ -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(())
Expand Down