Add custom flag for force sending images as document

This commit is contained in:
Tulir Asokan
2022-02-25 12:38:01 +02:00
parent 24162e14ac
commit b760aadb01
+3
View File
@@ -1642,6 +1642,9 @@ class Portal(DBPortal, BasePortal):
attributes.append(DocumentAttributeImageSize(w, h))
force_document = force_document or w * h >= max_image_pixels
if "fi.mau.telegram.force_document" in content:
force_document = bool(content["fi.mau.telegram.force_document"])
if (mime == "image/png" or mime == "image/jpeg") and not force_document:
media = InputMediaUploadedPhoto(file_handle)
else: