diff options
author | Vitaly Takmazov | 2018-12-01 20:43:47 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-12-01 20:43:47 +0300 |
commit | e69f1c22ea693041929fd0e50881f75e1b12e050 (patch) | |
tree | 7662209b21cc72fa33b88fbd1a79c9ebc6f3596a /src/main/java/com | |
parent | 5d06aa2ca4d1dc0d304e98fef6ac6a9108e0db9f (diff) |
Move telegram web hook url to config
Diffstat (limited to 'src/main/java/com')
-rw-r--r-- | src/main/java/com/juick/server/TelegramBotManager.java | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/main/java/com/juick/server/TelegramBotManager.java b/src/main/java/com/juick/server/TelegramBotManager.java index 518a7363..8a0c45dc 100644 --- a/src/main/java/com/juick/server/TelegramBotManager.java +++ b/src/main/java/com/juick/server/TelegramBotManager.java @@ -77,6 +77,8 @@ public class TelegramBotManager implements NotificationListener { private String apiUrl; @Value("${telegram_file_api_url:}") private String fileApiUrl; + @Value("${telegram_webhook_url:}") + private String webhookUrl; @Value("${telegram_token:12345678}") private String telegramToken; @Value("${telegram_debug:false}") @@ -98,15 +100,11 @@ public class TelegramBotManager implements NotificationListener { @PostConstruct public void init() { - if (StringUtils.isBlank(telegramToken)) { - logger.info("telegram token is not set, exiting"); - return; - } bot = new TelegramBot.Builder(telegramToken) .apiUrl(apiUrl).fileApiUrl(fileApiUrl).build(); if (!telegramDebug) { try { - SetWebhook webhook = new SetWebhook().url("https://api.juick.com/tlgmbtwbhk"); + SetWebhook webhook = new SetWebhook().url(webhookUrl); if (!bot.execute(webhook).isOk()) { logger.error("error setting webhook"); } |