aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-01-12 13:57:40 +0300
committerGravatar Vitaly Takmazov2023-01-12 14:33:57 +0300
commite7e5432aba9ae4cdba8a546969de0618968f8b57 (patch)
treec860acfd5064872fadeea936d889af40e918ceca /src/main
parent109173a39c601a9ea9b9642c6e8154c98cc9bee5 (diff)
Telegram: handle "chat not found" errors
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/juick/TelegramBotManager.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main/java/com/juick/TelegramBotManager.java b/src/main/java/com/juick/TelegramBotManager.java
index 3ca0f217..9dfea1a3 100644
--- a/src/main/java/com/juick/TelegramBotManager.java
+++ b/src/main/java/com/juick/TelegramBotManager.java
@@ -369,6 +369,19 @@ public class TelegramBotManager implements NotificationListener {
boolean status = telegramService.deleteTelegramUser(user.getUid());
logger.info("deleting telegram id of @{} : {}", user.getName(), status);
}
+ } else if (response.errorCode() == 400) {
+ if (response.description().equals("Bad Request: chat not found")) {
+ if (user.isAnonymous()) {
+ boolean status = telegramService.deleteAnonymous(chatId);
+ logger.info("deleting chat id {}: {}", chatId, status);
+ } else {
+ boolean status = telegramService.deleteTelegramUser(user.getUid());
+ logger.info("deleting telegram id of @{} : {}", user.getName(), status);
+ }
+ } else {
+ logger.warn("error response, isOk: {}, errorCode: {}, description: {}",
+ response.isOk(), response.errorCode(), response.description());
+ }
} else {
logger.warn("error response, isOk: {}, errorCode: {}, description: {}",
response.isOk(), response.errorCode(), response.description());