From a12975463c3389e506d24288341b30257419d8d2 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 13 Jan 2023 03:13:00 +0300 Subject: Telegram: fix commands response --- src/main/java/com/juick/TelegramBotManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/com/juick/TelegramBotManager.java b/src/main/java/com/juick/TelegramBotManager.java index 9dfea1a3..c9a2dadd 100644 --- a/src/main/java/com/juick/TelegramBotManager.java +++ b/src/main/java/com/juick/TelegramBotManager.java @@ -278,6 +278,7 @@ public class TelegramBotManager implements NotificationListener { } private void executeCommand(Integer messageId, Long userId, User user_from, String text, URI attachment) { + String messageTxt = "Unknown error or unsupported command"; try { CommandResult result = commandsManager.processCommand(user_from, text, attachment); if (result.getNewMessage().isPresent()) { @@ -285,8 +286,7 @@ public class TelegramBotManager implements NotificationListener { messagesService.setMessageProperty(newMessage.getMid(), newMessage.getRid(), "durovId", String.valueOf(messageId)); } - String messageTxt = StringUtils.isNotEmpty(result.getText()) ? result.getHtml() - : "Unknown error or unsupported command"; + messageTxt = StringUtils.isNotEmpty(result.getHtml()) ? result.getHtml() : result.getText(); telegramNotify(userId, messageTxt, new com.juick.model.Message()); } catch (Exception e) { logger.warn("telegram exception", e); -- cgit v1.2.3