aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src/main/java/com/juick/api
diff options
context:
space:
mode:
Diffstat (limited to 'juick-api/src/main/java/com/juick/api')
-rw-r--r--juick-api/src/main/java/com/juick/api/controllers/TelegramWebhook.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/juick-api/src/main/java/com/juick/api/controllers/TelegramWebhook.java b/juick-api/src/main/java/com/juick/api/controllers/TelegramWebhook.java
index 225e23ae..236e4064 100644
--- a/juick-api/src/main/java/com/juick/api/controllers/TelegramWebhook.java
+++ b/juick-api/src/main/java/com/juick/api/controllers/TelegramWebhook.java
@@ -29,6 +29,7 @@ import com.pengrad.telegrambot.model.PhotoSize;
import com.pengrad.telegrambot.model.Update;
import com.pengrad.telegrambot.request.GetFile;
import com.pengrad.telegrambot.response.GetFileResponse;
+import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -73,7 +74,9 @@ public class TelegramWebhook {
@RequestMapping(value = "/tlgmbtwbhk", method = RequestMethod.POST)
@ResponseStatus(value = HttpStatus.OK)
public void processUpdate(InputStream body) throws Exception {
- Update update = BotUtils.parseUpdate(new InputStreamReader(body, StandardCharsets.UTF_8));
+ String data = IOUtils.toString(body, StandardCharsets.UTF_8);
+ logger.info("got telegram msg: {}", data);
+ Update update = BotUtils.parseUpdate(data);
Message message = update.message();
if (update.message() == null) {
message = update.editedMessage();
@@ -82,8 +85,6 @@ public class TelegramWebhook {
return;
}
}
-
- logger.info("got telegram msg {}", message);
User user_from = usersService.getUserByUID(telegramService.getUser(message.chat().id())).orElse(new User());
logger.info("Found juick user {}", user_from.getUid());