Remove {token} from webhook url in heroku example

This commit is contained in:
Maybe Waffle 2022-09-25 01:06:11 +04:00
parent be9c20ef32
commit 78a96381dc

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