Revert "Revert some code"

This reverts commit 61136bedc8.
This commit is contained in:
Ilya Laktyushin
2022-04-21 16:29:49 +04:00
parent 6ddb31a338
commit 7ff92543ac
14 changed files with 471 additions and 167 deletions

View File

@@ -16,13 +16,22 @@ extension BotMenuButton {
extension BotInfo {
convenience init(apiBotInfo: Api.BotInfo) {
switch apiBotInfo {
case let .botInfo(_, description, commands, menuButton):
self.init(description: description, photo: nil, commands: commands.map { command in
switch command {
case let .botCommand(command, description):
return BotCommand(text: command, description: description)
case let .botInfo(_, _, description, descriptionPhoto, _, apiCommands, apiMenuButton):
let photo: TelegramMediaImage? = descriptionPhoto.flatMap(telegramMediaImageFromApiPhoto)
var commands: [BotCommand] = []
if let apiCommands = apiCommands {
commands = apiCommands.map { command in
switch command {
case let .botCommand(command, description):
return BotCommand(text: command, description: description)
}
}
}, menuButton: BotMenuButton(apiBotMenuButton: menuButton))
}
var menuButton: BotMenuButton = .commands
if let apiMenuButton = apiMenuButton {
menuButton = BotMenuButton(apiBotMenuButton: apiMenuButton)
}
self.init(description: description ?? "", photo: photo, commands: commands, menuButton: menuButton)
}
}
}

View File

@@ -8,9 +8,8 @@ extension ExportedInvitation {
switch apiExportedInvite {
case let .chatInviteExported(flags, link, adminId, date, startDate, expireDate, usageLimit, usage, requested, title):
self = .link(link: link, title: title, isPermanent: (flags & (1 << 5)) != 0, requestApproval: (flags & (1 << 6)) != 0, isRevoked: (flags & (1 << 0)) != 0, adminId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(adminId)), date: date, startDate: startDate, expireDate: expireDate, usageLimit: usageLimit, count: usage, requestedCount: requested)
/* case .chatInvitePublicJoinRequests:
case .chatInvitePublicJoinRequests:
self = .publicJoinRequest
*/
}
}
}