aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-01-13 03:13:00 +0300
committerGravatar Vitaly Takmazov2023-01-13 03:13:00 +0300
commita12975463c3389e506d24288341b30257419d8d2 (patch)
treec749d3ff6488465bf4e0c53f05e43986a900fb24 /src/main/java/com/juick
parentbdf1c3c33827abe277f8ecbbc07de710a1f05c89 (diff)
Telegram: fix commands response
Diffstat (limited to 'src/main/java/com/juick')
-rw-r--r--src/main/java/com/juick/TelegramBotManager.java4
1 files changed, 2 insertions, 2 deletions
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);