aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/juick/api/TelegramBotHook.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/main/java/com/juick/api/TelegramBotHook.java b/src/main/java/com/juick/api/TelegramBotHook.java
index 880be5e2..cf0979cd 100644
--- a/src/main/java/com/juick/api/TelegramBotHook.java
+++ b/src/main/java/com/juick/api/TelegramBotHook.java
@@ -7,6 +7,8 @@ import com.pengrad.telegrambot.Callback;
import com.pengrad.telegrambot.TelegramBot;
import com.pengrad.telegrambot.TelegramBotAdapter;
import com.pengrad.telegrambot.model.Message;
+import com.pengrad.telegrambot.model.request.InlineKeyboardButton;
+import com.pengrad.telegrambot.model.request.InlineKeyboardMarkup;
import com.pengrad.telegrambot.request.SendMessage;
import com.pengrad.telegrambot.response.SendResponse;
import org.json.JSONObject;
@@ -15,7 +17,6 @@ import org.springframework.jdbc.core.JdbcTemplate;
import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
@@ -62,11 +63,15 @@ public class TelegramBotHook {
if (jmsg.getAttachmentURL() != null) {
sb.append(jmsg.getAttachmentURL());
}
- sb.append("https://juick.com/").append(jmsg.getMID());
String msg = sb.toString();
List<Long> chats = getChats();
chats.stream().forEach(c -> {
- bot.execute(new SendMessage(c, msg), new Callback<SendMessage, SendResponse>() {
+ bot.execute(new SendMessage(c, msg).replyMarkup(
+ new InlineKeyboardMarkup(
+ new InlineKeyboardButton[] {
+ new InlineKeyboardButton("See on Juick").url("https://juick.com/" + jmsg.getMID())
+ }
+ )), new Callback<SendMessage, SendResponse>() {
@Override
public void onResponse(SendMessage request, SendResponse response) {
logger.info("got response: " + response.message().toString());