telegram: Fix size info of photo media
patch 497bfd6efd884d00e2d958e9ad8ac0b4009ad780
Author: E. Bosch <presidev@AT@gmail.com>
Date: Fri Feb 4 22:08:05 CET 2022
* telegram: Fix size info of photo media
diff -rN -u old-irgramd/telegram.py new-irgramd/telegram.py
--- old-irgramd/telegram.py 2024-11-23 02:39:08.241941252 +0100
+++ new-irgramd/telegram.py 2024-11-23 02:39:08.245941245 +0100
@@ -323,8 +323,11 @@
caption = ''
elif message.photo:
- size = [x for x in message.media.photo.sizes if x.type == 'x'][0]
- media_type = 'photo:{}x{}'.format(size.w, size.h)
+ size = message.media.photo.sizes[-1]
+ if hasattr(size, 'w') and hasattr(size, 'h'):
+ media_type = 'photo:{}x{}'.format(size.w, size.h)
+ else:
+ media_type = 'photo'
elif message.audio: media_type = 'audio'
elif message.voice: media_type = 'rec'
elif message.video: media_type = 'video'