Skip to content

Commit 5f87bbc

Browse files
committed
Add the new Photo type
1 parent be451a3 commit 5f87bbc

File tree

3 files changed

+46
-5
lines changed

3 files changed

+46
-5
lines changed

compiler/api/compiler.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -494,17 +494,16 @@ def start():
494494
f.write("\n 0xb0700015: \"pyrogram.client.types.ChatPhoto\",")
495495
f.write("\n 0xb0700016: \"pyrogram.client.types.ChatMember\",")
496496
f.write("\n 0xb0700017: \"pyrogram.client.types.Sticker\",")
497-
f.write("\n 0xb0700025: \"pyrogram.client.types.GIF\",")
498-
f.write("\n 0xb0700026: \"pyrogram.client.types.Messages\",")
499-
500497
f.write("\n 0xb0700018: \"pyrogram.client.types.reply_markup.ForceReply\",")
501498
f.write("\n 0xb0700019: \"pyrogram.client.types.reply_markup.InlineKeyboardButton\",")
502499
f.write("\n 0xb0700020: \"pyrogram.client.types.reply_markup.InlineKeyboardMarkup\",")
503500
f.write("\n 0xb0700021: \"pyrogram.client.types.reply_markup.KeyboardButton\",")
504501
f.write("\n 0xb0700022: \"pyrogram.client.types.reply_markup.ReplyKeyboardMarkup\",")
505502
f.write("\n 0xb0700023: \"pyrogram.client.types.reply_markup.ReplyKeyboardRemove\",")
506-
507-
f.write("\n 0xb0700024: \"pyrogram.client.types.CallbackQuery\"")
503+
f.write("\n 0xb0700024: \"pyrogram.client.types.CallbackQuery\",")
504+
f.write("\n 0xb0700025: \"pyrogram.client.types.GIF\",")
505+
f.write("\n 0xb0700026: \"pyrogram.client.types.Messages\",")
506+
f.write("\n 0xb0700027: \"pyrogram.client.types.Photo\",")
508507

509508
f.write("\n}\n")
510509

pyrogram/client/types/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from .message import Message
3232
from .message_entity import MessageEntity
3333
from .messages import Messages
34+
from .photo import Photo
3435
from .photo_size import PhotoSize
3536
from .reply_markup import (
3637
ForceReply, InlineKeyboardButton, InlineKeyboardMarkup,

pyrogram/client/types/photo.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Pyrogram - Telegram MTProto API Client Library for Python
2+
# Copyright (C) 2017-2018 Dan Tès <https://github.com/delivrance>
3+
#
4+
# This file is part of Pyrogram.
5+
#
6+
# Pyrogram is free software: you can redistribute it and/or modify
7+
# it under the terms of the GNU Lesser General Public License as published
8+
# by the Free Software Foundation, either version 3 of the License, or
9+
# (at your option) any later version.
10+
#
11+
# Pyrogram is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU Lesser General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU Lesser General Public License
17+
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
18+
19+
from pyrogram.api.core import Object
20+
21+
22+
class Photo(Object):
23+
"""This object represents a Photo
24+
25+
Args:
26+
id (``str``):
27+
Unique identifier for this photo.
28+
29+
date (``int``):
30+
Date the photo was sent in Unix time
31+
32+
sizes (List of :obj:`PhotoSize <pyrogram.PhotoSize>):
33+
Available sizes of this photo
34+
"""
35+
36+
ID = 0xb0700027
37+
38+
def __init__(self, id: str, date: int, sizes: list):
39+
self.id = id
40+
self.date = date
41+
self.sizes = sizes

0 commit comments

Comments
 (0)