Add chat flood error

This commit is contained in:
Ali
2023-03-20 16:34:11 +04:00
parent f92f4c38c6
commit 16d5058cc7
3 changed files with 12 additions and 1 deletions

View File

@@ -57,11 +57,14 @@ public enum PendingMessageFailureReason {
case slowmodeActive
case tooMuchScheduled
case voiceMessagesForbidden
case sendingTooFast
}
private func reasonForError(_ error: String) -> PendingMessageFailureReason? {
if error.hasPrefix("PEER_FLOOD") {
return .flood
} else if error.hasPrefix("SENDING_TOO_FAST") {
return .sendingTooFast
} else if error.hasPrefix("USER_BANNED_IN_CHANNEL") {
return .publicBan
} else if error.hasPrefix("CHAT_SEND_") && error.hasSuffix("_FORBIDDEN") {