Merge pull request #715 from teloxide/heroku_no_token_in_url

Remove `{token}` from webhook url in heroku example

Former-commit-id: 0bde3f4b38
This commit is contained in:
Waffle Maybe 2022-09-25 05:01:28 +04:00 committed by GitHub
commit 3a97c08c0e

View file

@ -21,7 +21,6 @@
use std::env;
use teloxide::{dispatching::update_listeners::webhooks, prelude::*};
use url::Url;
#[tokio::main]
async fn main() {
@ -29,7 +28,6 @@ async fn main() {
log::info!("Starting Heroku ping-pong bot...");
let bot = Bot::from_env().auto_send();
let token = bot.inner().token();
// Heroku auto defines a port value
let port: u16 = env::var("PORT")
@ -41,7 +39,7 @@ async fn main() {
// Heroku host example: "heroku-ping-pong-bot.herokuapp.com"
let host = env::var("HOST").expect("HOST env variable is not set");
let url = Url::parse(&format!("https://{host}/webhooks/{token}")).unwrap();
let url = format!("https://{host}/webhook").parse().unwrap();
let listener = webhooks::axum(bot.clone(), webhooks::Options::new(addr, url))
.await