diff options
author | 2018-04-05 22:17:57 +0300 | |
---|---|---|
committer | 2018-04-05 22:17:57 +0300 | |
commit | 767aec7729a326ff1ccc225d8623a24dd1e698d5 (patch) | |
tree | c694fc17767170200888a3348acebed67afe5e06 /juick-server/src/main/java/com/juick/server/TelegramBotManager.java | |
parent | 0cd08c7161fd3b5fe54d90b01ea35360ea5390dc (diff) |
server: markdown command reply
* also fixes new messages with one tag and attachment
Diffstat (limited to 'juick-server/src/main/java/com/juick/server/TelegramBotManager.java')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/TelegramBotManager.java | 8 |
1 files changed, 6 insertions, 2 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 4b2e5278..17ad4630 100644 --- a/juick-server/src/main/java/com/juick/server/TelegramBotManager.java +++ b/juick-server/src/main/java/com/juick/server/TelegramBotManager.java @@ -186,7 +186,9 @@ public class TelegramBotManager implements NotificationListener { prefix = String.format("#%d/%d ", mid, rid); } CommandResult result = commandsManager.processCommand(user_from, null,prefix + text, attachment); - telegramNotify(message.from().id().longValue(), result.getText(), StringUtils.EMPTY); + String messageTxt = StringUtils.isNotEmpty(result.getMarkdown()) ? result.getMarkdown() + : "Unknown error or unsupported command"; + telegramNotify(message.from().id().longValue(), messageTxt, StringUtils.EMPTY); } else { logger.warn("invalid path: {}", path); } @@ -203,7 +205,9 @@ public class TelegramBotManager implements NotificationListener { } } else { CommandResult result = commandsManager.processCommand(user_from, null, text, attachment); - telegramNotify(message.from().id().longValue(), result.getText(), StringUtils.EMPTY); + String messageTxt = StringUtils.isNotEmpty(result.getMarkdown()) ? result.getMarkdown() + : "Unknown error or unsupported command"; + telegramNotify(message.from().id().longValue(), messageTxt, StringUtils.EMPTY); } } } |