aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/api/TelegramBotHook.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-05-12 19:25:26 +0300
committerGravatar Vitaly Takmazov2016-05-12 19:25:26 +0300
commit70a6b6c49ee6e220942a43ae4328ce9dcd24232b (patch)
treef83067a7787cb214add9091d835a2c7c0544b060 /src/main/java/com/juick/api/TelegramBotHook.java
parent846d0b67d11ba9444a8a32ee173bb431683fa572 (diff)
initial telegram bot
Diffstat (limited to 'src/main/java/com/juick/api/TelegramBotHook.java')
-rw-r--r--src/main/java/com/juick/api/TelegramBotHook.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/main/java/com/juick/api/TelegramBotHook.java b/src/main/java/com/juick/api/TelegramBotHook.java
new file mode 100644
index 00000000..6d73fbfb
--- /dev/null
+++ b/src/main/java/com/juick/api/TelegramBotHook.java
@@ -0,0 +1,29 @@
+package com.juick.api;
+
+import com.pengrad.telegrambot.TelegramBot;
+import com.pengrad.telegrambot.TelegramBotAdapter;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.logging.Logger;
+
+/**
+ * Created by vt on 12/05/16.
+ */
+public class TelegramBotHook {
+ private static final Logger logger = Logger.getLogger(TelegramBotHook.class.getName());
+
+ private String token;
+ TelegramBot bot;
+
+
+ public TelegramBotHook(String token) {
+ this.token = token;
+ bot = TelegramBotAdapter.build(token);
+ bot.setWebhook("https://api.juick.com/tlgmbtwbhk");
+ }
+
+ public void doPost(HttpServletRequest request, HttpServletResponse response) {
+ logger.info("got telegram msg: " + request);
+ }
+}