From 0cd08c7161fd3b5fe54d90b01ea35360ea5390dc Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 5 Apr 2018 20:59:03 +0300 Subject: server: show command result in telegram --- .../src/main/java/com/juick/server/TelegramBotManager.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'juick-server/src/main/java/com/juick') 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); } } } -- cgit v1.2.3