Fix spoilers when sending InputPhoto and InputDocument

After this was reported as a problem for MessageMediaPhoto objects in #4584, it was fixed in commit 37e29e8, but the problem exists for InputPhoto and InputDocument, also. This commit fixes that
This commit is contained in:
Deer-Spangle 2025-07-25 13:20:00 +01:00 committed by GitHub
parent 01af2fcca3
commit 00adbdfc65
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -437,9 +437,9 @@ def get_input_media(
if media.SUBCLASS_OF_ID == 0xfaf846f4: # crc32(b'InputMedia') if media.SUBCLASS_OF_ID == 0xfaf846f4: # crc32(b'InputMedia')
return media return media
elif media.SUBCLASS_OF_ID == 0x846363e0: # crc32(b'InputPhoto') elif media.SUBCLASS_OF_ID == 0x846363e0: # crc32(b'InputPhoto')
return types.InputMediaPhoto(media, ttl_seconds=ttl) return types.InputMediaPhoto(media, ttl_seconds=ttl, spoiler=media.spoiler)
elif media.SUBCLASS_OF_ID == 0xf33fdb68: # crc32(b'InputDocument') elif media.SUBCLASS_OF_ID == 0xf33fdb68: # crc32(b'InputDocument')
return types.InputMediaDocument(media, ttl_seconds=ttl) return types.InputMediaDocument(media, ttl_seconds=ttl, spoiler=media.spoiler)
except AttributeError: except AttributeError:
_raise_cast_fail(media, 'InputMedia') _raise_cast_fail(media, 'InputMedia')