mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
canManageBots flag
This commit is contained in:
parent
e3eac999c4
commit
b5973fed13
3 changed files with 7 additions and 0 deletions
|
|
@ -128,6 +128,9 @@ extension TelegramUser {
|
|||
if (flags2 & (1 << 17)) != 0 {
|
||||
botFlags.insert(.forumManagedByUser)
|
||||
}
|
||||
if (flags2 & (1 << 18)) != 0 {
|
||||
botFlags.insert(.canManageBots)
|
||||
}
|
||||
botInfo = BotUserInfo(flags: botFlags, inlinePlaceholder: botInlinePlaceholder)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ public struct BotUserInfoFlags: OptionSet {
|
|||
public static let hasWebApp = BotUserInfoFlags(rawValue: (1 << 7))
|
||||
public static let hasForum = BotUserInfoFlags(rawValue: (1 << 8))
|
||||
public static let forumManagedByUser = BotUserInfoFlags(rawValue: (1 << 9))
|
||||
public static let canManageBots = BotUserInfoFlags(rawValue: (1 << 10))
|
||||
}
|
||||
|
||||
public struct BotUserInfo: PostboxCoding, Equatable {
|
||||
|
|
|
|||
|
|
@ -388,6 +388,7 @@ func _internal_sendBotRequestedPeer(account: Account, peerId: PeerId, messageId:
|
|||
public enum CreateBotError {
|
||||
case generic
|
||||
case occupied
|
||||
case limitExceeded
|
||||
}
|
||||
|
||||
func _internal_createBot(account: Account, name: String, username: String, managerPeerId: PeerId, viaDeeplink: Bool) -> Signal<EnginePeer, CreateBotError> {
|
||||
|
|
@ -410,6 +411,8 @@ func _internal_createBot(account: Account, name: String, username: String, manag
|
|||
|> mapError { error -> CreateBotError in
|
||||
if error.errorDescription == "USERNAME_OCCUPIED" {
|
||||
return .occupied
|
||||
} else if error.errorDescription == "BOT_CREATE_LIMIT_EXCEEDED" {
|
||||
return .limitExceeded
|
||||
} else {
|
||||
return .generic
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue