From 0879730b19ac8d5ea2250c320a17de0ed7361bb3 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 12 May 2016 23:37:48 +0300 Subject: notify subscribed users --- src/main/java/com/juick/api/TelegramBotHook.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') 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() { + @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); + } + }); } } } -- cgit v1.2.3