aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src/main/java/com/juick
diff options
context:
space:
mode:
Diffstat (limited to 'juick-api/src/main/java/com/juick')
-rw-r--r--juick-api/src/main/java/com/juick/api/TGBot.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/juick-api/src/main/java/com/juick/api/TGBot.java b/juick-api/src/main/java/com/juick/api/TGBot.java
index 882dc821..e0ab3e1e 100644
--- a/juick-api/src/main/java/com/juick/api/TGBot.java
+++ b/juick-api/src/main/java/com/juick/api/TGBot.java
@@ -1,5 +1,6 @@
package com.juick.api;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.juick.service.MessagesService;
import com.juick.service.TelegramService;
@@ -35,19 +36,26 @@ public class TGBot implements AutoCloseable {
TelegramBot bot;
WebSocket ws;
- ObjectMapper ms = new ObjectMapper();
+ private ObjectMapper ms;
@Inject
TelegramService telegramService;
@Inject
MessagesService messagesService;
+ private TGBot() {
+ throw new IllegalStateException();
+ }
public TGBot(String token) {
if (StringUtils.isBlank(token)) {
return;
}
bot = TelegramBotAdapter.build(token);
+ ms = new ObjectMapper();
+ ms.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
+ ms.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ ms.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT);
try {
SetWebhook webhook = new SetWebhook().url("https://api.juick.com/tlgmbtwbhk");
if (!bot.execute(webhook).isOk()) {