Skip to content

Commit 2e1bfc3

Browse files
committed
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.
1 parent 8c4b671 commit 2e1bfc3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2178,7 +2178,7 @@ async def delete_profile_photo() -> str:
21782178
)
21792179
if not photos.photos:
21802180
return "No profile photo to delete."
2181-
await client(functions.photos.DeletePhotosRequest(id=[photos.photos[0].id]))
2181+
await client(functions.photos.DeletePhotosRequest(id=[photos.photos[0]]))
21822182
return "Profile photo deleted."
21832183
except Exception as e:
21842184
return log_and_format_error("delete_profile_photo", e)

0 commit comments

Comments
 (0)