aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-04-05 20:59:03 +0300
committerGravatar Vitaly Takmazov2018-04-05 20:59:03 +0300
commit0cd08c7161fd3b5fe54d90b01ea35360ea5390dc (patch)
treebbcbd2cfda520bc4dffc3328a227fb255a3aae5a
parent664a19b816a0aeb9dcf148ae182234648bf30623 (diff)
server: show command result in telegram
-rw-r--r--juick-server/src/main/java/com/juick/server/TelegramBotManager.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/juick-server/src/main/java/com/juick/server/TelegramBotManager.java b/juick-server/src/main/java/com/juick/server/TelegramBotManager.java
index 2d2fd4ac..4b2e5278 100644
--- a/juick-server/src/main/java/com/juick/server/TelegramBotManager.java
+++ b/juick-server/src/main/java/com/juick/server/TelegramBotManager.java
@@ -22,6 +22,7 @@ import com.juick.server.component.LikeEvent;
import com.juick.server.component.MessageEvent;
import com.juick.server.component.PingEvent;
import com.juick.server.component.SubscribeEvent;
+import com.juick.server.helpers.CommandResult;
import com.juick.server.util.HttpUtils;
import com.juick.service.MessagesService;
import com.juick.service.SubscriptionService;
@@ -184,8 +185,8 @@ public class TelegramBotManager implements NotificationListener {
int rid = Integer.valueOf(uriComponents.getFragment());
prefix = String.format("#%d/%d ", mid, rid);
}
- commandsManager.processCommand(user_from, null,prefix + text, attachment);
- telegramNotify(message.from().id().longValue(), "Reply sent", StringUtils.EMPTY);
+ CommandResult result = commandsManager.processCommand(user_from, null,prefix + text, attachment);
+ telegramNotify(message.from().id().longValue(), result.getText(), StringUtils.EMPTY);
} else {
logger.warn("invalid path: {}", path);
}
@@ -201,8 +202,8 @@ public class TelegramBotManager implements NotificationListener {
"Can not reply to this message", replyMessage.messageId(), StringUtils.EMPTY);
}
} else {
- commandsManager.processCommand(user_from, null, text, attachment);
- telegramNotify(message.from().id().longValue(), "Message sent", StringUtils.EMPTY);
+ CommandResult result = commandsManager.processCommand(user_from, null, text, attachment);
+ telegramNotify(message.from().id().longValue(), result.getText(), StringUtils.EMPTY);
}
}
}