mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-29 13:27:47 +00:00
Fix delete_profile_photos
This commit is contained in:
parent
da7130b380
commit
2482358484
@ -16,10 +16,9 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from struct import unpack
|
|
||||||
from typing import List, Union
|
from typing import List, Union
|
||||||
|
|
||||||
from pyrogram.api import functions, types
|
from pyrogram.api import functions
|
||||||
from pyrogram.client.ext import utils
|
from pyrogram.client.ext import utils
|
||||||
from ...ext import BaseClient
|
from ...ext import BaseClient
|
||||||
|
|
||||||
@ -52,18 +51,7 @@ class DeleteProfilePhotos(BaseClient):
|
|||||||
app.delete_profile_photos([p.file_id for p in photos[1:]])
|
app.delete_profile_photos([p.file_id for p in photos[1:]])
|
||||||
"""
|
"""
|
||||||
photo_ids = photo_ids if isinstance(photo_ids, list) else [photo_ids]
|
photo_ids = photo_ids if isinstance(photo_ids, list) else [photo_ids]
|
||||||
input_photos = []
|
input_photos = [utils.get_input_media_from_file_id(i).id for i in photo_ids]
|
||||||
|
|
||||||
for photo_id in photo_ids:
|
|
||||||
unpacked = unpack("<iiqqc", utils.decode_file_id(photo_id))
|
|
||||||
|
|
||||||
input_photos.append(
|
|
||||||
types.InputPhoto(
|
|
||||||
id=unpacked[2],
|
|
||||||
access_hash=unpacked[3],
|
|
||||||
file_reference=b""
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
return bool(self.send(
|
return bool(self.send(
|
||||||
functions.photos.DeletePhotos(
|
functions.photos.DeletePhotos(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user