fix(delete_profile_photo): pass Photo object instead of int to DeletePhotosRequest

Telethon's DeletePhotosRequest requires InputPhoto objects, which it derives
from Photo objects via get_input_photo(). Passing photo.id (an int) causes:
  AttributeError: 'int' object has no attribute 'SUBCLASS_OF_ID'
  TypeError: Cannot cast int to any kind of InputPhoto.

Fix: pass the Photo object directly (photos.photos[0]) so Telethon can
convert it to InputPhoto internally.
This commit is contained in:
Ivan Kolodrivskyi 2026-02-22 10:25:56 +02:00
parent 8c4b671c12
commit 2e1bfc3d94

View file

@ -2178,7 +2178,7 @@ async def delete_profile_photo() -> str:
)
if not photos.photos:
return "No profile photo to delete."
await client(functions.photos.DeletePhotosRequest(id=[photos.photos[0].id]))
await client(functions.photos.DeletePhotosRequest(id=[photos.photos[0]]))
return "Profile photo deleted."
except Exception as e:
return log_and_format_error("delete_profile_photo", e)