Steffo99 / greed

Customizable, multilanguage Telegram shop bot with Payments support
GNU Affero General Public License v3.0
534 stars 262 forks source link

Sending non-compressed photos crashes the conversation #138

Open tripoflgb opened 3 years ago

tripoflgb commented 3 years ago

Please help fix error, add photo to product from Windows Telegram client or phone (selected file)

Worker 1895432016 | worker | Exception in <Worker 1895432016>: list index out of range Traceback (most recent call last): File "/root/garminbot/worker.py", line 254, in run self.admin_menu() File "/root/garminbot/worker.py", line 1757, in __admin_menu self.products_menu() File "/root/garminbot/worker.py", line 1966, in __products_menu self.edit_product_menu() File "/root/garminbot/worker.py", line 2088, in edit_product_menu largest_photo = photo_list[0] IndexError: list index out of range z1

Steffo99 commented 3 years ago

You sent a non-compressed photo, which greed doesn't support...

It's weird that python-telegram-bot considered it a photo, though...

I'll investigate when I have time.

tripoflgb commented 3 years ago

If i send a non-compressed / compressed photo, please fix in next update.

Steffo99 commented 3 years ago

I think it's due to the Bot API 5.3 update.

Now photos have a different JSON structure, so trying to access the PhotoSize array fails.

I think that something should be changed here:

https://github.com/Steffo99/greed/blob/28967de9fb26d7e0a01a4dd56a7e7e28fbae91ba/worker.py#L1067-L1070