use telegram-bot-api in debug builds (controlled by presense of env variable)
This commit is contained in:
parent
02758f6789
commit
0bf6c1b63e
1 changed files with 3 additions and 3 deletions
|
|
@ -27,11 +27,11 @@ use super::start::{cmd_start, handle_my_chat_member};
|
|||
pub async fn bot_main(db: DbPool) -> anyhow::Result<()> {
|
||||
event!(Level::INFO, "start");
|
||||
|
||||
let bot = if cfg!(debug_assertions) {
|
||||
let bot = if let Ok(api_url) = std::env::var("BOT_API_URL") {
|
||||
Bot::new(unwrap_env("BOT_TOKEN"))
|
||||
.set_api_url(Url::from_str(&api_url).unwrap())
|
||||
} else {
|
||||
// we use telegram bot api server only in production
|
||||
Bot::new(unwrap_env("BOT_TOKEN")).set_api_url(Url::from_str(&unwrap_env("BOT_API_URL"))?)
|
||||
Bot::new(unwrap_env("BOT_TOKEN"))
|
||||
};
|
||||
|
||||
let listener = Polling::builder(bot.clone())
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue