aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-05-13 11:26:34 +0300
committerGravatar Vitaly Takmazov2016-05-13 11:26:34 +0300
commitc0115554aac7106974e12fd5b66ceaf69cee6e84 (patch)
tree2551c2c7b749757ba1a4798cf66232811e67ada4 /src/main/java/com
parent0713cb62f8abf99252ce9e07c06e40c96f04f3b0 (diff)
full message format
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/juick/api/TelegramBotHook.java10
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());