From 2e1bfc3d94b2fbd90ed22fd6b2cac80999c47d5c Mon Sep 17 00:00:00 2001 From: Ivan Kolodrivskyi Date: Sun, 22 Feb 2026 10:25:56 +0200 Subject: [PATCH] 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. --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index bcd89ce..3ecbf73 100644 --- a/main.py +++ b/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)