diff options
Diffstat (limited to 'juick-api/src/main/java/com/juick')
-rw-r--r-- | juick-api/src/main/java/com/juick/api/TGBot.java | 6 |
1 files changed, 5 insertions, 1 deletions
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() { |