mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
Merge pull request #715 from teloxide/heroku_no_token_in_url
Remove `{token}` from webhook url in heroku example
This commit is contained in:
commit
0bde3f4b38
1 changed files with 1 additions and 3 deletions
|
@ -21,7 +21,6 @@
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
use teloxide::{dispatching::update_listeners::webhooks, prelude::*};
|
use teloxide::{dispatching::update_listeners::webhooks, prelude::*};
|
||||||
use url::Url;
|
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
|
@ -29,7 +28,6 @@ async fn main() {
|
||||||
log::info!("Starting Heroku ping-pong bot...");
|
log::info!("Starting Heroku ping-pong bot...");
|
||||||
|
|
||||||
let bot = Bot::from_env().auto_send();
|
let bot = Bot::from_env().auto_send();
|
||||||
let token = bot.inner().token();
|
|
||||||
|
|
||||||
// Heroku auto defines a port value
|
// Heroku auto defines a port value
|
||||||
let port: u16 = env::var("PORT")
|
let port: u16 = env::var("PORT")
|
||||||
|
@ -41,7 +39,7 @@ async fn main() {
|
||||||
|
|
||||||
// Heroku host example: "heroku-ping-pong-bot.herokuapp.com"
|
// Heroku host example: "heroku-ping-pong-bot.herokuapp.com"
|
||||||
let host = env::var("HOST").expect("HOST env variable is not set");
|
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))
|
let listener = webhooks::axum(bot.clone(), webhooks::Options::new(addr, url))
|
||||||
.await
|
.await
|
||||||
|
|
Loading…
Reference in a new issue