diff options
Diffstat (limited to 'juick-api')
-rw-r--r-- | juick-api/build.gradle | 2 | ||||
-rw-r--r-- | juick-api/src/main/java/com/juick/api/TGBot.java | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/juick-api/build.gradle b/juick-api/build.gradle index 08991eed..382ea8bd 100644 --- a/juick-api/build.gradle +++ b/juick-api/build.gradle @@ -25,7 +25,7 @@ dependencies { compile "org.springframework.security:spring-security-config:${springSecurityVersion}" providedCompile 'javax.servlet:javax.servlet-api:3.1.0' - compile 'com.github.pengrad:java-telegram-bot-api:2.1.4' + compile 'com.github.pengrad:java-telegram-bot-api:2.3.0' compile 'org.msbotframework4j:msbotframework4j-builder:0.1.4' compile 'com.neovisionaries:nv-websocket-client:1.30' compile 'net.coobird:thumbnailator:0.4.8' diff --git a/juick-api/src/main/java/com/juick/api/TGBot.java b/juick-api/src/main/java/com/juick/api/TGBot.java index 73aaa2b9..ae3c6b74 100644 --- a/juick-api/src/main/java/com/juick/api/TGBot.java +++ b/juick-api/src/main/java/com/juick/api/TGBot.java @@ -13,6 +13,7 @@ import com.pengrad.telegrambot.TelegramBotAdapter; import com.pengrad.telegrambot.model.request.InlineKeyboardButton; import com.pengrad.telegrambot.model.request.InlineKeyboardMarkup; import com.pengrad.telegrambot.request.SendMessage; +import com.pengrad.telegrambot.request.SetWebhook; import com.pengrad.telegrambot.response.SendResponse; import org.apache.commons.lang3.StringUtils; import org.json.JSONObject; @@ -49,7 +50,10 @@ public class TGBot implements AutoCloseable { } bot = TelegramBotAdapter.build(token); try { - bot.setWebhook("https://api.juick.com/tlgmbtwbhk"); + SetWebhook webhook = new SetWebhook().url("https://api.juick.com/tlgmbtwbhk"); + if (!bot.execute(webhook).isOk()) { + logger.error("error setting webhook"); + } ws = new WebSocketFactory().createSocket("wss://ws.juick.com/"); ws.setPingInterval(60 * 1000); ws.addListener(new WebSocketAdapter() { |