2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-29 05:18:10 +00:00

Merge branch 'develop' into asyncio-dev

This commit is contained in:
Dan 2019-09-29 12:53:44 +02:00
commit 79a04f2961

View File

@ -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(await self.send( return bool(await self.send(
functions.photos.DeletePhotos( functions.photos.DeletePhotos(