aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src/main
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-11-02 17:48:16 +0300
committerGravatar Vitaly Takmazov2017-11-02 17:48:16 +0300
commit8a8683bc35583fed27b6562907a66bd171f8e778 (patch)
tree735d3bfe15cb81219d23d081b75486de9d91910f /juick-api/src/main
parent3bbf2004183058d0476c25b5ff2a3f50c80165c9 (diff)
api: log raw telegram response
Diffstat (limited to 'juick-api/src/main')
-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());