use telegram bot api only in production
This commit is contained in:
parent
82897a8e36
commit
9cc888258f
1 changed files with 6 additions and 2 deletions
|
|
@ -27,8 +27,12 @@ use super::start::{cmd_start, handle_my_chat_member};
|
||||||
pub async fn bot_main(db: DbPool) -> anyhow::Result<()> {
|
pub async fn bot_main(db: DbPool) -> anyhow::Result<()> {
|
||||||
event!(Level::INFO, "start");
|
event!(Level::INFO, "start");
|
||||||
|
|
||||||
let bot =
|
let bot = if cfg!(debug_assertions) {
|
||||||
Bot::new(unwrap_env("BOT_TOKEN")).set_api_url(Url::from_str(&unwrap_env("BOT_API_URL"))?);
|
Bot::new(unwrap_env("BOT_TOKEN"))
|
||||||
|
} 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"))?)
|
||||||
|
};
|
||||||
|
|
||||||
let listener = Polling::builder(bot.clone())
|
let listener = Polling::builder(bot.clone())
|
||||||
.timeout(Duration::from_secs(parse_env("POLLING_TIMEOUT")))
|
.timeout(Duration::from_secs(parse_env("POLLING_TIMEOUT")))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue