diff --git a/examples/heroku_ping_pong_bot/src/main.rs b/examples/heroku_ping_pong_bot/src/main.rs index 2043ec49..653fc9f8 100644 --- a/examples/heroku_ping_pong_bot/src/main.rs +++ b/examples/heroku_ping_pong_bot/src/main.rs @@ -8,7 +8,7 @@ use tokio::sync::mpsc; use tokio_stream::wrappers::UnboundedReceiverStream; use warp::Filter; -use reqwest::StatusCode; +use reqwest::{StatusCode, Url}; #[tokio::main] async fn main() { @@ -30,7 +30,7 @@ pub async fn webhook(bot: AutoSend) -> impl update_listeners::UpdateListene // Heroku host example .: "heroku-ping-pong-bot.herokuapp.com" let host = env::var("HOST").expect("have HOST env variable"); let path = format!("bot{}", teloxide_token); - let url = format!("https://{}/{}", host, path); + let url = Url::parse(&format!("https://{}/{}", host, path)).unwrap(); bot.set_webhook(url).await.expect("Cannot setup a webhook"); diff --git a/examples/ngrok_ping_pong_bot/src/main.rs b/examples/ngrok_ping_pong_bot/src/main.rs index 8a35d5ad..c748e0c8 100644 --- a/examples/ngrok_ping_pong_bot/src/main.rs +++ b/examples/ngrok_ping_pong_bot/src/main.rs @@ -8,7 +8,7 @@ use tokio::sync::mpsc; use tokio_stream::wrappers::UnboundedReceiverStream; use warp::Filter; -use reqwest::StatusCode; +use reqwest::{StatusCode, Url}; #[tokio::main] async fn main() { @@ -21,9 +21,11 @@ async fn handle_rejection(error: warp::Rejection) -> Result) -> impl update_listeners::UpdateListener { + let url = Url::parse("Your HTTPS ngrok URL here. Get it by `ngrok http 80`").unwrap(); + // You might want to specify a self-signed certificate via .certificate // method on SetWebhook. - bot.set_webhook("Your HTTPS ngrok URL here. Get it by `ngrok http 80`") + bot.set_webhook(url) .await .expect("Cannot setup a webhook");