aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-05-12 23:37:48 +0300
committerGravatar Vitaly Takmazov2016-05-12 23:37:48 +0300
commit0879730b19ac8d5ea2250c320a17de0ed7361bb3 (patch)
tree5cf56f09766cb006afb7ca65a94c4e9acc6d4696 /src
parentd77b21dcf62c3e8d63615d5ef5acaaaf2614736d (diff)
notify subscribed users
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/juick/api/TelegramBotHook.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/com/juick/api/TelegramBotHook.java b/src/main/java/com/juick/api/TelegramBotHook.java
index 2d64b83e..7ee759eb 100644
--- a/src/main/java/com/juick/api/TelegramBotHook.java
+++ b/src/main/java/com/juick/api/TelegramBotHook.java
@@ -83,6 +83,17 @@ public class TelegramBotHook {
if (!chats.contains(message.chat().id())) {
chats.add(message.chat().id());
logger.info("added chat with " + message.from().firstName());
+ bot.execute(new SendMessage(message.chat().id(), "Subscribed!"), new Callback<SendMessage, SendResponse>() {
+ @Override
+ public void onResponse(SendMessage request, SendResponse response) {
+ logger.info("got response: " + response.message().toString());
+ }
+
+ @Override
+ public void onFailure(SendMessage request, IOException e) {
+ logger.log(Level.WARNING, "telegram failure", e);
+ }
+ });
}
}
}