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:
parent
8c4b671c12
commit
2e1bfc3d94
1 changed files with 1 additions and 1 deletions
2
main.py
2
main.py
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue