diff options
Diffstat (limited to 'src/main/java/com/juick')
-rw-r--r-- | src/main/java/com/juick/api/TelegramBotHook.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/com/juick/api/TelegramBotHook.java b/src/main/java/com/juick/api/TelegramBotHook.java index 7ee759eb..6a6404de 100644 --- a/src/main/java/com/juick/api/TelegramBotHook.java +++ b/src/main/java/com/juick/api/TelegramBotHook.java @@ -54,9 +54,15 @@ public class TelegramBotHook { public void onTextMessage(WebSocket websocket, String text) throws Exception { super.onTextMessage(websocket, text); com.juick.Message jmsg = ms.deserialize(new JSONObject(text)); - logger.info("got jmsg: " + jmsg.toString()); + logger.info("got jmsg: " + ms.serialize(jmsg).toString()); + StringBuilder sb = new StringBuilder(); + sb.append(jmsg.getUser()).append("\n").append(jmsg.getText()).append("\n"); + if (jmsg.getAttachmentURL() != null) { + sb.append(jmsg.getAttachmentURL()); + } + sb.append("https://juick.com/" + jmsg.getMID()); chats.stream().forEach(c -> { - bot.execute(new SendMessage(c, jmsg.getText()), new Callback<SendMessage, SendResponse>() { + bot.execute(new SendMessage(c, sb.toString()), new Callback<SendMessage, SendResponse>() { @Override public void onResponse(SendMessage request, SendResponse response) { logger.info("got response: " + response.message().toString()); |