aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/server/TelegramBotManager.java
diff options
context:
space:
mode:
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.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 020d2433..320ab9ae 100644
--- a/juick-server/src/main/java/com/juick/server/TelegramBotManager.java
+++ b/juick-server/src/main/java/com/juick/server/TelegramBotManager.java
@@ -53,6 +53,7 @@ import org.springframework.web.util.UriComponentsBuilder;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import java.io.IOException;
+import java.net.URI;
import java.net.URL;
import java.util.*;
@@ -129,7 +130,7 @@ public class TelegramBotManager implements NotificationListener {
if (user_from.getUid() == 0) {
telegramSignupNotify(message.from().id().longValue(), userService.getSignUpHashByTelegramID(message.from().id().longValue(), username));
} else {
- String attachment = StringUtils.EMPTY;
+ URI attachment = URI.create(StringUtils.EMPTY);
if (message.photo() != null) {
String fileId = Arrays.stream(message.photo()).max(Comparator.comparingInt(PhotoSize::fileSize))
.orElse(new PhotoSize()).fileId();
@@ -149,7 +150,7 @@ public class TelegramBotManager implements NotificationListener {
if (StringUtils.isBlank(text)) {
text = StringUtils.EMPTY;
}
- if (StringUtils.isNotEmpty(text) || StringUtils.isNotEmpty(attachment)) {
+ if (StringUtils.isNotEmpty(text) || StringUtils.isNotEmpty(attachment.toString())) {
if (text.equalsIgnoreCase("LOGIN")
|| text.equalsIgnoreCase("PING")
|| text.equalsIgnoreCase("HELP")
@@ -183,7 +184,7 @@ public class TelegramBotManager implements NotificationListener {
int rid = Integer.valueOf(uriComponents.getFragment());
prefix = String.format("#%d/%d ", mid, rid);
}
- xmppConnection.processMessage(user_from, prefix + text, attachment);
+ xmppConnection.incomingMessageJuick(user_from, null,prefix + text, attachment);
telegramNotify(message.from().id().longValue(), "Reply sent", StringUtils.EMPTY);
} else {
logger.warn("invalid path: {}", path);
@@ -200,7 +201,7 @@ public class TelegramBotManager implements NotificationListener {
"Can not reply to this message", replyMessage.messageId(), StringUtils.EMPTY);
}
} else {
- xmppConnection.processMessage(user_from, text, attachment);
+ xmppConnection.incomingMessageJuick(user_from, null, text, attachment);
telegramNotify(message.from().id().longValue(), "Message sent", StringUtils.EMPTY);
}
}