Merge commit 'cb415abfccadff11e210e797ace8c1b59d74e4f7'

This commit is contained in:
Ali
2023-06-30 19:48:46 +02:00
26 changed files with 958 additions and 130 deletions

View File

@@ -611,3 +611,26 @@ extension Api.EncryptedMessage {
}
}
}
extension Api.InputMedia {
func withUpdatedStickers(_ stickers: [Api.InputDocument]?) -> Api.InputMedia {
switch self {
case let .inputMediaUploadedDocument(flags, file, thumb, mimeType, attributes, _, ttlSeconds):
var flags = flags
var attributes = attributes
if let _ = stickers {
flags |= (1 << 0)
attributes.append(.documentAttributeHasStickers)
}
return .inputMediaUploadedDocument(flags: flags, file: file, thumb: thumb, mimeType: mimeType, attributes: attributes, stickers: stickers, ttlSeconds: ttlSeconds)
case let .inputMediaUploadedPhoto(flags, file, _, ttlSeconds):
var flags = flags
if let _ = stickers {
flags |= (1 << 0)
}
return .inputMediaUploadedPhoto(flags: flags, file: file, stickers: stickers, ttlSeconds: ttlSeconds)
default:
return self
}
}
}