diff --git a/pom.xml b/pom.xml
index 32e1d00..669b927 100644
--- a/pom.xml
+++ b/pom.xml
@@ -52,7 +52,7 @@
it.tdlight
tdlib-session-container
- 4.0.16
+ 4.0.22
org.openjfx
diff --git a/src/main/java/it/cavallium/TransferServiceImpl.java b/src/main/java/it/cavallium/TransferServiceImpl.java
index 273a439..39c57e6 100644
--- a/src/main/java/it/cavallium/TransferServiceImpl.java
+++ b/src/main/java/it/cavallium/TransferServiceImpl.java
@@ -538,6 +538,8 @@ public class TransferServiceImpl implements TransferService {
return userStatusConsumer.apply(new UserStatus(getName(user), user.id, UserStatusType.USER_PRIVACY_RESTRICTED, "")).then(Mono.empty());
} else if (TdLightUtils.errorEquals(new TdError(result.cause().code, result.cause().message), 400, "USER_NOT_MUTUAL_CONTACT")) {
return userStatusConsumer.apply(new UserStatus(getName(user), user.id, UserStatusType.USER_NOT_MUTUAL_CONTACT, "")).then(Mono.empty());
+ } else if (TdLightUtils.errorEquals(new TdError(result.cause().code, result.cause().message), 400, "PEER_FLOOD")) {
+ return userStatusConsumer.apply(new UserStatus(getName(user), user.id, UserStatusType.ADD_FLOOD, "")).then(Mono.empty());
}
}
return Mono.just(result);
@@ -545,11 +547,20 @@ public class TransferServiceImpl implements TransferService {
.flatMap(MonoUtils::orElseThrow)
.timeout(Duration.ofMinutes(2))
.onErrorResume((error) -> {
- App.getLogService().append(Level.WARN, "Can't add user \"" + getName(user) + "\" to supergroup \"" + destGroup.getSupergroupIdInt() + " " + destGroup.getTitle() + "\"");
+ App.getLogService().append(Level.WARN, "Can't add user \"" + getName(user) + "\" to supergroup \"" + destGroup.getSupergroupIdInt() + " " + destGroup.getTitle() + "\" (" + error.getLocalizedMessage() + ")");
return userStatusConsumer.apply(new UserStatus(getName(user), user.id, UserStatusType.CANT_ADD, "Can't add to destination supergroup: " + error.getLocalizedMessage())).then(Mono.empty());
})
.flatMap(_v -> {
- return userStatusConsumer.apply(new UserStatus(getName(user), user.id, UserStatusType.ADDED_AND_WAITING_TO_BE_REMOVED, "")).then(Mono.empty()).thenReturn(user);
+ UserStatusType userStatusType;
+ if (REMOVE_MEMBERS_FROM_SOURCE_SUPERGROUP) {
+ userStatusType = UserStatusType.ADDED_AND_WAITING_TO_BE_REMOVED;
+ } else {
+ userStatusType = UserStatusType.DONE;
+ }
+ return userStatusConsumer
+ .apply(new UserStatus(getName(user), user.id, userStatusType, ""))
+ .then(Mono.empty())
+ .thenReturn(user);
});
})
.flatMap(user -> {
@@ -576,7 +587,8 @@ public class TransferServiceImpl implements TransferService {
});
} else {
// Don't remove the user from the source supergroup
- return Mono.just(user);
+ transferredSuccessfullyUsersStats.incrementAndGet();
+ return userStatusConsumer.apply(new UserStatus(getName(user), user.id, UserStatusType.DONE, "")).then(Mono.empty()).thenReturn(user);
}
})
.delayElements(App.getSettingsService().getDelayBetweenAdds())
diff --git a/src/main/java/it/cavallium/UserStatus.java b/src/main/java/it/cavallium/UserStatus.java
index 228f68a..a25d1a7 100644
--- a/src/main/java/it/cavallium/UserStatus.java
+++ b/src/main/java/it/cavallium/UserStatus.java
@@ -53,6 +53,8 @@ public class UserStatus {
return "❌ Can't add to destination group: this user privacy settings don't allow invitations to groups";
case USER_NOT_MUTUAL_CONTACT:
return "❌ Can't add to destination group: this user only allows mutual contacts to invite it in the destination group";
+ case ADD_FLOOD:
+ return "✔️ Can't add to destination group: an userbot has been blocked by telegram for flooding";
case CANT_ADD:
return "❌ Can't add to destination group";
case UNKNOWN:
diff --git a/src/main/java/it/cavallium/UserStatusType.java b/src/main/java/it/cavallium/UserStatusType.java
index 8d47f9d..661ad48 100644
--- a/src/main/java/it/cavallium/UserStatusType.java
+++ b/src/main/java/it/cavallium/UserStatusType.java
@@ -1,5 +1,18 @@
package it.cavallium;
public enum UserStatusType {
- NO_ACCESS_HASH, NOT_REGULAR_USER, SCAM_USER, RESTRICTED_USER, JUST_FOUND, CANT_ADD, ADDED_AND_WAITING_TO_BE_REMOVED, DONE, CANT_REMOVE, USER_PRIVACY_RESTRICTED, USER_NOT_MUTUAL_CONTACT, CANT_REMOVE_CHAT_OWNER, UNKNOWN
+ NO_ACCESS_HASH,
+ NOT_REGULAR_USER,
+ SCAM_USER,
+ RESTRICTED_USER,
+ JUST_FOUND,
+ CANT_ADD,
+ ADDED_AND_WAITING_TO_BE_REMOVED,
+ DONE,
+ CANT_REMOVE,
+ USER_PRIVACY_RESTRICTED,
+ USER_NOT_MUTUAL_CONTACT,
+ CANT_REMOVE_CHAT_OWNER,
+ ADD_FLOOD,
+ UNKNOWN
}
diff --git a/tdlib-session-container b/tdlib-session-container
index b1ab477..a04010d 160000
--- a/tdlib-session-container
+++ b/tdlib-session-container
@@ -1 +1 @@
-Subproject commit b1ab4777479c10d48d2fec8392c52a6b66d66233
+Subproject commit a04010d72b8c8eb4165697f07c3da685b1a88a50