canManageBots flag

This commit is contained in:
Mikhail Filimonov 2026-03-27 16:18:42 +01:00
parent e3eac999c4
commit b5973fed13
3 changed files with 7 additions and 0 deletions

View file

@ -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)
}

View file

@ -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 {

View file

@ -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
}