diff --git a/compiler/api/compiler.py b/compiler/api/compiler.py
index d1bf8cfa..7c1412d1 100644
--- a/compiler/api/compiler.py
+++ b/compiler/api/compiler.py
@@ -494,17 +494,16 @@ def start():
f.write("\n 0xb0700015: \"pyrogram.client.types.ChatPhoto\",")
f.write("\n 0xb0700016: \"pyrogram.client.types.ChatMember\",")
f.write("\n 0xb0700017: \"pyrogram.client.types.Sticker\",")
- f.write("\n 0xb0700025: \"pyrogram.client.types.GIF\",")
- f.write("\n 0xb0700026: \"pyrogram.client.types.Messages\",")
-
f.write("\n 0xb0700018: \"pyrogram.client.types.reply_markup.ForceReply\",")
f.write("\n 0xb0700019: \"pyrogram.client.types.reply_markup.InlineKeyboardButton\",")
f.write("\n 0xb0700020: \"pyrogram.client.types.reply_markup.InlineKeyboardMarkup\",")
f.write("\n 0xb0700021: \"pyrogram.client.types.reply_markup.KeyboardButton\",")
f.write("\n 0xb0700022: \"pyrogram.client.types.reply_markup.ReplyKeyboardMarkup\",")
f.write("\n 0xb0700023: \"pyrogram.client.types.reply_markup.ReplyKeyboardRemove\",")
-
- f.write("\n 0xb0700024: \"pyrogram.client.types.CallbackQuery\"")
+ f.write("\n 0xb0700024: \"pyrogram.client.types.CallbackQuery\",")
+ f.write("\n 0xb0700025: \"pyrogram.client.types.GIF\",")
+ f.write("\n 0xb0700026: \"pyrogram.client.types.Messages\",")
+ f.write("\n 0xb0700027: \"pyrogram.client.types.Photo\",")
f.write("\n}\n")
diff --git a/docs/source/pyrogram/Client.rst b/docs/source/pyrogram/Client.rst
index 0000b35f..2fbd5879 100644
--- a/docs/source/pyrogram/Client.rst
+++ b/docs/source/pyrogram/Client.rst
@@ -42,6 +42,7 @@ Client
send_chat_action
download_media
get_user_profile_photos
+ delete_profile_photos
edit_message_text
edit_message_caption
edit_message_reply_markup
diff --git a/docs/source/pyrogram/types/Photo.rst b/docs/source/pyrogram/types/Photo.rst
new file mode 100644
index 00000000..78fe13f4
--- /dev/null
+++ b/docs/source/pyrogram/types/Photo.rst
@@ -0,0 +1,5 @@
+Photo
+=====
+
+.. autoclass:: pyrogram.Photo
+ :members:
diff --git a/docs/source/pyrogram/types/index.rst b/docs/source/pyrogram/types/index.rst
index 2fc74e49..ff3de94e 100644
--- a/docs/source/pyrogram/types/index.rst
+++ b/docs/source/pyrogram/types/index.rst
@@ -9,6 +9,7 @@ Types
Message
MessageEntity
Messages
+ Photo
PhotoSize
Audio
Document
diff --git a/pyrogram/__init__.py b/pyrogram/__init__.py
index 51f25e51..5122cab9 100644
--- a/pyrogram/__init__.py
+++ b/pyrogram/__init__.py
@@ -37,8 +37,8 @@ from .api.errors import Error
from .client.types import (
Audio, Chat, ChatMember, ChatPhoto, Contact, Document, InputMediaPhoto,
InputMediaVideo, InputPhoneContact, Location, Message, MessageEntity,
- PhotoSize, Sticker, Update, User, UserProfilePhotos, Venue, GIF, Video,
- VideoNote, Voice, CallbackQuery, Messages
+ Photo, PhotoSize, Sticker, Update, User, UserProfilePhotos, Venue, GIF,
+ Video, VideoNote, Voice, CallbackQuery, Messages
)
from .client.types.reply_markup import (
ForceReply, InlineKeyboardButton, InlineKeyboardMarkup,
diff --git a/pyrogram/client/ext/utils.py b/pyrogram/client/ext/utils.py
index 83dde23f..be484823 100644
--- a/pyrogram/client/ext/utils.py
+++ b/pyrogram/client/ext/utils.py
@@ -329,13 +329,23 @@ async def parse_messages(
),
width=size.w,
height=size.h,
- file_size=file_size,
- date=photo.date
+ file_size=file_size
)
photo_sizes.append(photo_size)
- photo = photo_sizes
+ photo = pyrogram_types.Photo(
+ id=b64encode(
+ pack(
+ ".
+from .delete_profile_photos import DeleteProfilePhotos
from .get_me import GetMe
from .get_user_profile_photos import GetUserProfilePhotos
from .get_users import GetUsers
@@ -23,6 +24,7 @@ from .get_users import GetUsers
class Users(
GetUserProfilePhotos,
+ DeleteProfilePhotos,
GetUsers,
GetMe
):
diff --git a/pyrogram/client/methods/users/delete_profile_photos.py b/pyrogram/client/methods/users/delete_profile_photos.py
new file mode 100644
index 00000000..47a6682a
--- /dev/null
+++ b/pyrogram/client/methods/users/delete_profile_photos.py
@@ -0,0 +1,58 @@
+# Pyrogram - Telegram MTProto API Client Library for Python
+# Copyright (C) 2017-2018 Dan Tès
+#
+# This file is part of Pyrogram.
+#
+# Pyrogram is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published
+# by the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pyrogram is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Pyrogram. If not, see .
+
+from base64 import b64decode
+from struct import unpack
+
+from pyrogram.api import functions, types
+from ...ext import BaseClient
+
+
+class DeleteProfilePhotos(BaseClient):
+ def delete_profile_photos(self, id: str or list):
+ """Use this method to delete your own profile photos
+
+ Args:
+ id (``str`` | ``list``):
+ A single :obj:`Photo ` id as string or multiple ids as list of strings for deleting
+ more than one photos at once.
+
+ Returns:
+ True on success.
+
+ Raises:
+ :class:`Error `
+ """
+ id = id if isinstance(id, list) else [id]
+ input_photos = []
+
+ for i in id:
+ s = unpack("`
"""
- return utils.parse_photos(
+ return utils.parse_profile_photos(
await self.send(
functions.photos.GetUserPhotos(
user_id=await self.resolve_peer(user_id),
diff --git a/pyrogram/client/types/__init__.py b/pyrogram/client/types/__init__.py
index acd001dd..84c12a44 100644
--- a/pyrogram/client/types/__init__.py
+++ b/pyrogram/client/types/__init__.py
@@ -31,6 +31,7 @@ from .location import Location
from .message import Message
from .message_entity import MessageEntity
from .messages import Messages
+from .photo import Photo
from .photo_size import PhotoSize
from .reply_markup import (
ForceReply, InlineKeyboardButton, InlineKeyboardMarkup,
diff --git a/pyrogram/client/types/message.py b/pyrogram/client/types/message.py
index 096c8170..86c40f75 100644
--- a/pyrogram/client/types/message.py
+++ b/pyrogram/client/types/message.py
@@ -89,8 +89,8 @@ class Message(Object):
game (:obj:`Game `, *optional*):
Message is a game, information about the game. More about games.
- photo (List of :obj:`PhotoSize `, *optional*):
- Message is a photo, available sizes of the photo.
+ photo (:obj:`Photo `, *optional*):
+ Message is a photo, information about the photo.
sticker (:obj:`Sticker `, *optional*):
Message is a sticker, information about the sticker.
@@ -132,7 +132,7 @@ class Message(Object):
new_chat_title (``str``, *optional*):
A chat title was changed to this value.
- new_chat_photo (List of :obj:`PhotoSize `, *optional*):
+ new_chat_photo (:obj:`Photo `, *optional*):
A chat photo was change to this value.
delete_chat_photo (``bool``, *optional*):
diff --git a/pyrogram/client/types/photo.py b/pyrogram/client/types/photo.py
new file mode 100644
index 00000000..f5494f13
--- /dev/null
+++ b/pyrogram/client/types/photo.py
@@ -0,0 +1,41 @@
+# Pyrogram - Telegram MTProto API Client Library for Python
+# Copyright (C) 2017-2018 Dan Tès
+#
+# This file is part of Pyrogram.
+#
+# Pyrogram is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published
+# by the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pyrogram is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Pyrogram. If not, see .
+
+from pyrogram.api.core import Object
+
+
+class Photo(Object):
+ """This object represents a Photo
+
+ Args:
+ id (``str``):
+ Unique identifier for this photo.
+
+ date (``int``):
+ Date the photo was sent in Unix time
+
+ sizes (List of :obj:`PhotoSize `):
+ Available sizes of this photo
+ """
+
+ ID = 0xb0700027
+
+ def __init__(self, id: str, date: int, sizes: list):
+ self.id = id
+ self.date = date
+ self.sizes = sizes
diff --git a/pyrogram/client/types/photo_size.py b/pyrogram/client/types/photo_size.py
index 7e9b3cba..65691de0 100644
--- a/pyrogram/client/types/photo_size.py
+++ b/pyrogram/client/types/photo_size.py
@@ -32,18 +32,14 @@ class PhotoSize(Object):
height (``int``):
Photo height.
- file_size (``int``, *optional*):
+ file_size (``int``):
File size.
-
- date (``int``, *optional*):
- Date the photo was sent in Unix time
"""
ID = 0xb0700005
- def __init__(self, file_id, width, height, file_size=None, date=None):
- self.file_id = file_id # string
- self.width = width # int
- self.height = height # int
- self.file_size = file_size # flags.0?int
- self.date = date
+ def __init__(self, file_id: str, width: int, height: int, file_size: int):
+ self.file_id = file_id
+ self.width = width
+ self.height = height
+ self.file_size = file_size
diff --git a/pyrogram/client/types/reply_markup/reply_keyboard_remove.py b/pyrogram/client/types/reply_markup/reply_keyboard_remove.py
index de32f740..3e2aebf5 100644
--- a/pyrogram/client/types/reply_markup/reply_keyboard_remove.py
+++ b/pyrogram/client/types/reply_markup/reply_keyboard_remove.py
@@ -35,7 +35,7 @@ class ReplyKeyboardRemove(Object):
keyboard for that user, while still showing the keyboard with poll options to users who haven't voted yet.
"""
- ID = 0xb0700002
+ ID = 0xb0700023
def __init__(self, selective: bool = None):
self.selective = selective
diff --git a/pyrogram/client/types/user_profile_photos.py b/pyrogram/client/types/user_profile_photos.py
index 1b7ecbb4..c8ca9e39 100644
--- a/pyrogram/client/types/user_profile_photos.py
+++ b/pyrogram/client/types/user_profile_photos.py
@@ -26,12 +26,12 @@ class UserProfilePhotos(Object):
total_count (``int``):
Total number of profile pictures the target user has.
- photos (List of List of :obj:`PhotoSize `):
- Requested profile pictures (in up to 4 sizes each).
+ photos (List of :obj:`Photo `):
+ Requested profile pictures.
"""
ID = 0xb0700014
def __init__(self, total_count: int, photos: list):
- self.total_count = total_count # int
- self.photos = photos # Vector>
+ self.total_count = total_count
+ self.photos = photos