From 8ac48c555c027f76978c5339b19be48f48518aa5 Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Wed, 13 Jun 2018 13:34:56 +0200
Subject: [PATCH 001/249] Add ipv6 data center addresses
---
pyrogram/session/internals/data_center.py | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/pyrogram/session/internals/data_center.py b/pyrogram/session/internals/data_center.py
index 232ca13b..154cd9e0 100644
--- a/pyrogram/session/internals/data_center.py
+++ b/pyrogram/session/internals/data_center.py
@@ -34,5 +34,24 @@ class DataCenter:
121: "95.213.217.195"
}
- def __new__(cls, dc_id: int, test_mode: bool):
- return (cls.TEST[dc_id], 80) if test_mode else (cls.PROD[dc_id], 443)
+ TEST_IPV6 = {
+ 1: "2001:0b28:f23d:f001:0000:0000:0000:000e",
+ 2: "2001:067c:04e8:f002:0000:0000:0000:000e",
+ 3: "2001:0b28:f23d:f003:0000:0000:0000:000e",
+ 121: "2a03:b0c0:0003:00d0:0000:0000:0114:d001"
+ }
+
+ PROD_IPV6 = {
+ 1: "2001:0b28:f23d:f001:0000:0000:0000:000a",
+ 2: "2001:067c:04e8:f002:0000:0000:0000:000a",
+ 3: "2001:0b28:f23d:f003:0000:0000:0000:000a",
+ 4: "2001:067c:04e8:f004:0000:0000:0000:000a",
+ 5: "2001:0b28:f23f:f005:0000:0000:0000:000a",
+ 121: "2a03:b0c0:0003:00d0:0000:0000:0114:d001"
+ }
+
+ def __new__(cls, dc_id: int, test_mode: bool, ipv6: bool):
+ if ipv6:
+ return (cls.TEST_IPV6[dc_id], 80) if test_mode else (cls.PROD_IPV6[dc_id], 443)
+ else:
+ return (cls.TEST[dc_id], 80) if test_mode else (cls.PROD[dc_id], 443)
From efe26bcb196f4fe6a9a6c4db385d48eba47c6593 Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Wed, 13 Jun 2018 13:35:41 +0200
Subject: [PATCH 002/249] Allow Connection to connect to ipv6 addresses
---
pyrogram/connection/connection.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/pyrogram/connection/connection.py b/pyrogram/connection/connection.py
index a53295ce..043f7cb7 100644
--- a/pyrogram/connection/connection.py
+++ b/pyrogram/connection/connection.py
@@ -21,6 +21,7 @@ import threading
import time
from .transport import *
+from ..session.internals import DataCenter
log = logging.getLogger(__name__)
@@ -36,16 +37,18 @@ class Connection:
4: TCPIntermediateO
}
- def __init__(self, address: tuple, proxy: dict, mode: int = 1):
- self.address = address
+ def __init__(self, dc_id: int, test_mode: bool, ipv6: bool, proxy: dict, mode: int = 1):
+ self.ipv6 = ipv6
self.proxy = proxy
+ self.address = DataCenter(dc_id, test_mode, ipv6)
self.mode = self.MODES.get(mode, TCPAbridged)
+
self.lock = threading.Lock()
self.connection = None
def connect(self):
for i in range(Connection.MAX_RETRIES):
- self.connection = self.mode(self.proxy)
+ self.connection = self.mode(self.ipv6, self.proxy)
try:
log.info("Connecting...")
From 56748ff39075b41c427987127f975a9d672ee999 Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Wed, 13 Jun 2018 13:36:26 +0200
Subject: [PATCH 003/249] Make the underlying TCP protocol accept ipv6
addresses
---
pyrogram/connection/transport/tcp/tcp.py | 5 +++--
pyrogram/connection/transport/tcp/tcp_abridged.py | 4 ++--
pyrogram/connection/transport/tcp/tcp_abridged_o.py | 5 +++--
pyrogram/connection/transport/tcp/tcp_full.py | 5 +++--
pyrogram/connection/transport/tcp/tcp_intermediate.py | 4 ++--
pyrogram/connection/transport/tcp/tcp_intermediate_o.py | 5 +++--
6 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/pyrogram/connection/transport/tcp/tcp.py b/pyrogram/connection/transport/tcp/tcp.py
index 5df8aacb..8560604f 100644
--- a/pyrogram/connection/transport/tcp/tcp.py
+++ b/pyrogram/connection/transport/tcp/tcp.py
@@ -33,8 +33,9 @@ log = logging.getLogger(__name__)
class TCP(socks.socksocket):
- def __init__(self, proxy: dict):
- super().__init__()
+ def __init__(self, ipv6: bool, proxy: dict):
+ super().__init__(family=socket.AF_INET6 if ipv6 else socket.AF_INET)
+
self.settimeout(10)
self.proxy_enabled = proxy.get("enabled", False)
diff --git a/pyrogram/connection/transport/tcp/tcp_abridged.py b/pyrogram/connection/transport/tcp/tcp_abridged.py
index 472f4799..d89421f5 100644
--- a/pyrogram/connection/transport/tcp/tcp_abridged.py
+++ b/pyrogram/connection/transport/tcp/tcp_abridged.py
@@ -24,8 +24,8 @@ log = logging.getLogger(__name__)
class TCPAbridged(TCP):
- def __init__(self, proxy: dict):
- super().__init__(proxy)
+ def __init__(self, ipv6: bool, proxy: dict):
+ super().__init__(ipv6, proxy)
def connect(self, address: tuple):
super().connect(address)
diff --git a/pyrogram/connection/transport/tcp/tcp_abridged_o.py b/pyrogram/connection/transport/tcp/tcp_abridged_o.py
index bba88e34..57cc0336 100644
--- a/pyrogram/connection/transport/tcp/tcp_abridged_o.py
+++ b/pyrogram/connection/transport/tcp/tcp_abridged_o.py
@@ -28,8 +28,9 @@ log = logging.getLogger(__name__)
class TCPAbridgedO(TCP):
RESERVED = (b"HEAD", b"POST", b"GET ", b"OPTI", b"\xee" * 4)
- def __init__(self, proxy: dict):
- super().__init__(proxy)
+ def __init__(self, ipv6: bool, proxy: dict):
+ super().__init__(ipv6, proxy)
+
self.encrypt = None
self.decrypt = None
diff --git a/pyrogram/connection/transport/tcp/tcp_full.py b/pyrogram/connection/transport/tcp/tcp_full.py
index 1b131678..0aac1a14 100644
--- a/pyrogram/connection/transport/tcp/tcp_full.py
+++ b/pyrogram/connection/transport/tcp/tcp_full.py
@@ -26,8 +26,9 @@ log = logging.getLogger(__name__)
class TCPFull(TCP):
- def __init__(self, proxy: dict):
- super().__init__(proxy)
+ def __init__(self, ipv6: bool, proxy: dict):
+ super().__init__(ipv6, proxy)
+
self.seq_no = None
def connect(self, address: tuple):
diff --git a/pyrogram/connection/transport/tcp/tcp_intermediate.py b/pyrogram/connection/transport/tcp/tcp_intermediate.py
index 4b2e2596..b33fe466 100644
--- a/pyrogram/connection/transport/tcp/tcp_intermediate.py
+++ b/pyrogram/connection/transport/tcp/tcp_intermediate.py
@@ -25,8 +25,8 @@ log = logging.getLogger(__name__)
class TCPIntermediate(TCP):
- def __init__(self, proxy: dict):
- super().__init__(proxy)
+ def __init__(self, ipv6: bool, proxy: dict):
+ super().__init__(ipv6, proxy)
def connect(self, address: tuple):
super().connect(address)
diff --git a/pyrogram/connection/transport/tcp/tcp_intermediate_o.py b/pyrogram/connection/transport/tcp/tcp_intermediate_o.py
index df79352a..e8c96ebc 100644
--- a/pyrogram/connection/transport/tcp/tcp_intermediate_o.py
+++ b/pyrogram/connection/transport/tcp/tcp_intermediate_o.py
@@ -29,8 +29,9 @@ log = logging.getLogger(__name__)
class TCPIntermediateO(TCP):
RESERVED = (b"HEAD", b"POST", b"GET ", b"OPTI", b"\xee" * 4)
- def __init__(self, proxy: dict):
- super().__init__(proxy)
+ def __init__(self, ipv6: bool, proxy: dict):
+ super().__init__(ipv6, proxy)
+
self.encrypt = None
self.decrypt = None
From c9469ed5428ed0a6495a986a9f9afd26b214001a Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Wed, 13 Jun 2018 13:37:12 +0200
Subject: [PATCH 004/249] Allow auth to use ipv6
---
pyrogram/session/auth.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/pyrogram/session/auth.py b/pyrogram/session/auth.py
index 80956187..2142be59 100644
--- a/pyrogram/session/auth.py
+++ b/pyrogram/session/auth.py
@@ -26,7 +26,7 @@ from pyrogram.api import functions, types
from pyrogram.api.core import Object, Long, Int
from pyrogram.connection import Connection
from pyrogram.crypto import AES, RSA, Prime
-from .internals import MsgId, DataCenter
+from .internals import MsgId
log = logging.getLogger(__name__)
@@ -46,9 +46,10 @@ class Auth:
16
)
- def __init__(self, dc_id: int, test_mode: bool, proxy: dict):
+ def __init__(self, dc_id: int, test_mode: bool, ipv6: bool, proxy: dict):
self.dc_id = dc_id
self.test_mode = test_mode
+ self.ipv6 = ipv6
self.proxy = proxy
self.connection = None
@@ -84,7 +85,7 @@ class Auth:
# The server may close the connection at any time, causing the auth key creation to fail.
# If that happens, just try again up to MAX_RETRIES times.
while True:
- self.connection = Connection(DataCenter(self.dc_id, self.test_mode), self.proxy)
+ self.connection = Connection(self.dc_id, self.test_mode, self.ipv6, self.proxy)
try:
log.info("Start creating a new auth key on DC{}".format(self.dc_id))
From b804709c6c6a88f7b95d3db62c2a231ec7c9591d Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Wed, 13 Jun 2018 13:37:35 +0200
Subject: [PATCH 005/249] Allow session to use ipv6
---
pyrogram/session/session.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/pyrogram/session/session.py b/pyrogram/session/session.py
index 7e90cfff..82751f21 100644
--- a/pyrogram/session/session.py
+++ b/pyrogram/session/session.py
@@ -35,7 +35,7 @@ from pyrogram.api.core import Message, Object, MsgContainer, Long, FutureSalt, I
from pyrogram.api.errors import Error, InternalServerError
from pyrogram.connection import Connection
from pyrogram.crypto import AES, KDF
-from .internals import MsgId, MsgFactory, DataCenter
+from .internals import MsgId, MsgFactory
log = logging.getLogger(__name__)
@@ -86,6 +86,7 @@ class Session:
def __init__(self,
dc_id: int,
test_mode: bool,
+ ipv6: bool,
proxy: dict,
auth_key: bytes,
api_id: int,
@@ -98,6 +99,7 @@ class Session:
self.dc_id = dc_id
self.test_mode = test_mode
+ self.ipv6 = ipv6
self.proxy = proxy
self.api_id = api_id
self.is_cdn = is_cdn
@@ -130,7 +132,7 @@ class Session:
def start(self):
while True:
- self.connection = Connection(DataCenter(self.dc_id, self.test_mode), self.proxy)
+ self.connection = Connection(self.dc_id, self.test_mode, self.ipv6, self.proxy)
try:
self.connection.connect()
From ade1c2f377902c3c2b6c1f4e406bc21a3acd7e4f Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Wed, 13 Jun 2018 13:38:14 +0200
Subject: [PATCH 006/249] Accommodate ipv6 in the Client class
---
pyrogram/client/client.py | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py
index 73f45966..65490a55 100644
--- a/pyrogram/client/client.py
+++ b/pyrogram/client/client.py
@@ -129,6 +129,7 @@ class Client(Methods, BaseClient):
session_name: str,
api_id: int or str = None,
api_hash: str = None,
+ ipv6: bool = False,
proxy: dict = None,
test_mode: bool = False,
phone_number: str = None,
@@ -145,6 +146,7 @@ class Client(Methods, BaseClient):
self.session_name = session_name
self.api_id = int(api_id) if api_id else None
self.api_hash = api_hash
+ self.ipv6 = ipv6
# TODO: Make code consistent, use underscore for private/protected fields
self._proxy = proxy
self.test_mode = test_mode
@@ -194,6 +196,7 @@ class Client(Methods, BaseClient):
self.session = Session(
self.dc_id,
self.test_mode,
+ self.ipv6,
self._proxy,
self.auth_key,
self.api_id,
@@ -342,11 +345,12 @@ class Client(Methods, BaseClient):
self.session.stop()
self.dc_id = e.x
- self.auth_key = Auth(self.dc_id, self.test_mode, self._proxy).create()
+ self.auth_key = Auth(self.dc_id, self.test_mode, self.ipv6, self._proxy).create()
self.session = Session(
self.dc_id,
self.test_mode,
+ self.ipv6,
self._proxy,
self.auth_key,
self.api_id,
@@ -390,11 +394,12 @@ class Client(Methods, BaseClient):
self.session.stop()
self.dc_id = e.x
- self.auth_key = Auth(self.dc_id, self.test_mode, self._proxy).create()
+ self.auth_key = Auth(self.dc_id, self.test_mode, self.ipv6, self._proxy).create()
self.session = Session(
self.dc_id,
self.test_mode,
+ self.ipv6,
self._proxy,
self.auth_key,
self.api_id,
@@ -871,7 +876,7 @@ class Client(Methods, BaseClient):
except FileNotFoundError:
self.dc_id = 1
self.date = 0
- self.auth_key = Auth(self.dc_id, self.test_mode, self._proxy).create()
+ self.auth_key = Auth(self.dc_id, self.test_mode, self.ipv6, self._proxy).create()
else:
self.dc_id = s["dc_id"]
self.test_mode = s["test_mode"]
@@ -1022,7 +1027,7 @@ class Client(Methods, BaseClient):
file_id = file_id or self.rnd_id()
md5_sum = md5() if not is_big and not is_missing_part else None
- session = Session(self.dc_id, self.test_mode, self._proxy, self.auth_key, self.api_id)
+ session = Session(self.dc_id, self.test_mode, self.ipv6, self._proxy, self.auth_key, self.api_id)
session.start()
try:
@@ -1108,8 +1113,9 @@ class Client(Methods, BaseClient):
session = Session(
dc_id,
self.test_mode,
+ self.ipv6,
self._proxy,
- Auth(dc_id, self.test_mode, self._proxy).create(),
+ Auth(dc_id, self.test_mode, self.ipv6, self._proxy).create(),
self.api_id
)
@@ -1127,6 +1133,7 @@ class Client(Methods, BaseClient):
session = Session(
dc_id,
self.test_mode,
+ self.ipv6,
self._proxy,
self.auth_key,
self.api_id
@@ -1197,8 +1204,9 @@ class Client(Methods, BaseClient):
cdn_session = Session(
r.dc_id,
self.test_mode,
+ self.ipv6,
self._proxy,
- Auth(r.dc_id, self.test_mode, self._proxy).create(),
+ Auth(r.dc_id, self.test_mode, self.ipv6, self._proxy).create(),
self.api_id,
is_cdn=True
)
From d38d23f46df7fb03aeefff9938c0b80e3000a065 Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Wed, 13 Jun 2018 13:39:06 +0200
Subject: [PATCH 007/249] Log in case connection fails (to test ipv6)
---
pyrogram/connection/connection.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/pyrogram/connection/connection.py b/pyrogram/connection/connection.py
index 043f7cb7..ca9bd96c 100644
--- a/pyrogram/connection/connection.py
+++ b/pyrogram/connection/connection.py
@@ -53,7 +53,8 @@ class Connection:
try:
log.info("Connecting...")
self.connection.connect(self.address)
- except OSError:
+ except OSError as e:
+ log.warning(e) # TODO: Remove
self.connection.close()
time.sleep(1)
else:
From 321ee5e07d9d7e8357bdb6b6334a3c092a9e4ef4 Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Wed, 27 Jun 2018 16:53:18 +0200
Subject: [PATCH 008/249] Add missing method to docs
---
docs/source/pyrogram/Client.rst | 1 +
1 file changed, 1 insertion(+)
diff --git a/docs/source/pyrogram/Client.rst b/docs/source/pyrogram/Client.rst
index 0448c3cb..0000b35f 100644
--- a/docs/source/pyrogram/Client.rst
+++ b/docs/source/pyrogram/Client.rst
@@ -62,6 +62,7 @@ Client
get_inline_bot_results
send_inline_bot_result
answer_callback_query
+ request_callback_answer
get_users
get_chat
get_messages
From 7d8ebdc0dd6fd51f461b60a5f95d73f0e4b66de5 Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Thu, 28 Jun 2018 00:11:48 +0200
Subject: [PATCH 009/249] Add "406 Not Acceptable" error class
---
compiler/error/source/406_NOT_ACCEPTABLE.tsv | 1 +
1 file changed, 1 insertion(+)
create mode 100644 compiler/error/source/406_NOT_ACCEPTABLE.tsv
diff --git a/compiler/error/source/406_NOT_ACCEPTABLE.tsv b/compiler/error/source/406_NOT_ACCEPTABLE.tsv
new file mode 100644
index 00000000..d82f6e11
--- /dev/null
+++ b/compiler/error/source/406_NOT_ACCEPTABLE.tsv
@@ -0,0 +1 @@
+id message
From 38b7abec3546603697094a22182ec374265c56b3 Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Thu, 28 Jun 2018 00:15:53 +0200
Subject: [PATCH 010/249] Add AUTH_KEY_DUPLICATED error
---
compiler/error/source/406_NOT_ACCEPTABLE.tsv | 1 +
1 file changed, 1 insertion(+)
diff --git a/compiler/error/source/406_NOT_ACCEPTABLE.tsv b/compiler/error/source/406_NOT_ACCEPTABLE.tsv
index d82f6e11..3a88a7b6 100644
--- a/compiler/error/source/406_NOT_ACCEPTABLE.tsv
+++ b/compiler/error/source/406_NOT_ACCEPTABLE.tsv
@@ -1 +1,2 @@
id message
+AUTH_KEY_DUPLICATED Authorization error. You must log out and log in again with your phone number. We apologize for the inconvenience.
\ No newline at end of file
From 6e4c608875885c7753af1862614255b120323865 Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Thu, 28 Jun 2018 00:16:12 +0200
Subject: [PATCH 011/249] Handle AUTH_KEY_DUPLICATED error
---
pyrogram/session/session.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/pyrogram/session/session.py b/pyrogram/session/session.py
index ef7b565c..b7645b11 100644
--- a/pyrogram/session/session.py
+++ b/pyrogram/session/session.py
@@ -31,7 +31,7 @@ from pyrogram import __copyright__, __license__, __version__
from pyrogram.api import functions, types, core
from pyrogram.api.all import layer
from pyrogram.api.core import Message, Object, MsgContainer, Long, FutureSalt, Int
-from pyrogram.api.errors import Error, InternalServerError
+from pyrogram.api.errors import Error, InternalServerError, AuthKeyDuplicated
from pyrogram.connection import Connection
from pyrogram.crypto import AES, KDF
from .internals import MsgId, MsgFactory, DataCenter
@@ -157,6 +157,9 @@ class Session:
self.ping_thread.start()
log.info("Connection inited: Layer {}".format(layer))
+ except AuthKeyDuplicated as e:
+ self.stop()
+ raise e
except (OSError, TimeoutError, Error):
self.stop()
except Exception as e:
From 0935c4837f2c9cf9f66b69c48ddea81f0d1a6d53 Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Thu, 28 Jun 2018 18:41:16 +0200
Subject: [PATCH 012/249] Fix ReplyKeyboardRemove id
---
pyrogram/client/types/reply_markup/reply_keyboard_remove.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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
From be451a3bb2d055101c5440786ae1680fb30bf307 Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Thu, 28 Jun 2018 18:49:09 +0200
Subject: [PATCH 013/249] Rename parse_photos to parse_profile_photos
---
pyrogram/client/ext/utils.py | 2 +-
pyrogram/client/methods/users/get_user_profile_photos.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pyrogram/client/ext/utils.py b/pyrogram/client/ext/utils.py
index 2913c38b..3d2f88c1 100644
--- a/pyrogram/client/ext/utils.py
+++ b/pyrogram/client/ext/utils.py
@@ -757,7 +757,7 @@ def get_offset_date(dialogs):
return 0
-def parse_photos(photos):
+def parse_profile_photos(photos):
if isinstance(photos, types.photos.Photos):
total_count = len(photos.photos)
else:
diff --git a/pyrogram/client/methods/users/get_user_profile_photos.py b/pyrogram/client/methods/users/get_user_profile_photos.py
index 42fb84bb..5613c21d 100644
--- a/pyrogram/client/methods/users/get_user_profile_photos.py
+++ b/pyrogram/client/methods/users/get_user_profile_photos.py
@@ -48,7 +48,7 @@ class GetUserProfilePhotos(BaseClient):
Raises:
:class:`Error `
"""
- return utils.parse_photos(
+ return utils.parse_profile_photos(
self.send(
functions.photos.GetUserPhotos(
user_id=self.resolve_peer(user_id),
From 5f87bbc962d35e33e0faeba5c06a3c0f2bc6e916 Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Thu, 28 Jun 2018 19:04:45 +0200
Subject: [PATCH 014/249] Add the new Photo type
---
compiler/api/compiler.py | 9 +++----
pyrogram/client/types/__init__.py | 1 +
pyrogram/client/types/photo.py | 41 +++++++++++++++++++++++++++++++
3 files changed, 46 insertions(+), 5 deletions(-)
create mode 100644 pyrogram/client/types/photo.py
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/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/photo.py b/pyrogram/client/types/photo.py
new file mode 100644
index 00000000..39fb8d94
--- /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
From 971299f59283278d296d365e2f125c5a9f97f58a Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Thu, 28 Jun 2018 19:05:08 +0200
Subject: [PATCH 015/249] PhotoSize won't store date info anymore
---
pyrogram/client/types/photo_size.py | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
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
From fb10b3b0e7e767610a7774a7e933185c9046151e Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Thu, 28 Jun 2018 19:05:47 +0200
Subject: [PATCH 016/249] UserProfilePhoto.photos is now a list of Photo
objects
---
pyrogram/client/types/user_profile_photos.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
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
From a3761144b37e24a0d1f956ea1d29e42c936f053a Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Thu, 28 Jun 2018 19:07:02 +0200
Subject: [PATCH 017/249] Use Photo as type for media messages
---
pyrogram/client/ext/utils.py | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/pyrogram/client/ext/utils.py b/pyrogram/client/ext/utils.py
index 3d2f88c1..105d0f0c 100644
--- a/pyrogram/client/ext/utils.py
+++ b/pyrogram/client/ext/utils.py
@@ -329,13 +329,23 @@ 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(
+ "
Date: Thu, 28 Jun 2018 19:07:56 +0200
Subject: [PATCH 018/249] Use Photo as type for new_chat_photo
---
pyrogram/client/ext/utils.py | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/pyrogram/client/ext/utils.py b/pyrogram/client/ext/utils.py
index 105d0f0c..2b66aeb9 100644
--- a/pyrogram/client/ext/utils.py
+++ b/pyrogram/client/ext/utils.py
@@ -674,13 +674,23 @@ 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)
- new_chat_photo = photo_sizes
+ new_chat_photo = pyrogram_types.Photo(
+ id=b64encode(
+ pack(
+ "
Date: Thu, 28 Jun 2018 19:08:21 +0200
Subject: [PATCH 019/249] Use Photo as type for UserProfilePhotos photos list
---
pyrogram/client/ext/utils.py | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/pyrogram/client/ext/utils.py b/pyrogram/client/ext/utils.py
index 2b66aeb9..3f287b49 100644
--- a/pyrogram/client/ext/utils.py
+++ b/pyrogram/client/ext/utils.py
@@ -815,13 +815,25 @@ def parse_profile_photos(photos):
),
width=size.w,
height=size.h,
- file_size=file_size,
- date=photo.date
+ file_size=file_size
)
photo_sizes.append(photo_size)
- user_profile_photos.append(photo_sizes)
+ user_profile_photos.append(
+ pyrogram_types.Photo(
+ id=b64encode(
+ pack(
+ "
Date: Thu, 28 Jun 2018 19:09:27 +0200
Subject: [PATCH 020/249] Change photo type in Message
---
pyrogram/client/types/message.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pyrogram/client/types/message.py b/pyrogram/client/types/message.py
index b969865c..b9048f1e 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.
From 0dfe373c889d0d150fe46f50e6fe875e99ba1c8d Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Thu, 28 Jun 2018 19:13:47 +0200
Subject: [PATCH 021/249] Make Photo work in download_media
---
pyrogram/client/methods/download_media.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pyrogram/client/methods/download_media.py b/pyrogram/client/methods/download_media.py
index 5eb04fbc..89b0f61d 100644
--- a/pyrogram/client/methods/download_media.py
+++ b/pyrogram/client/methods/download_media.py
@@ -77,7 +77,7 @@ class DownloadMedia(BaseClient):
"""
if isinstance(message, pyrogram_types.Message):
if message.photo:
- media = message.photo[-1]
+ media = message.photo.sizes[-1]
elif message.audio:
media = message.audio
elif message.document:
@@ -95,7 +95,7 @@ class DownloadMedia(BaseClient):
else:
return
elif isinstance(message, (
- pyrogram_types.PhotoSize,
+ pyrogram_types.Photo,
pyrogram_types.Audio,
pyrogram_types.Document,
pyrogram_types.Video,
From 1e5156b150ec3d1271c592a57c725cb1db8e948f Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Thu, 28 Jun 2018 19:14:29 +0200
Subject: [PATCH 022/249] Add Photo type to docs
---
docs/source/pyrogram/types/Photo.rst | 5 +++++
1 file changed, 5 insertions(+)
create mode 100644 docs/source/pyrogram/types/Photo.rst
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:
From 30497b0e91635a9808904aeb846a14b70fa6e289 Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Thu, 28 Jun 2018 19:59:26 +0200
Subject: [PATCH 023/249] Add delete_profile_photos method
---
pyrogram/client/methods/users/__init__.py | 2 +
.../methods/users/delete_profile_photos.py | 58 +++++++++++++++++++
2 files changed, 60 insertions(+)
create mode 100644 pyrogram/client/methods/users/delete_profile_photos.py
diff --git a/pyrogram/client/methods/users/__init__.py b/pyrogram/client/methods/users/__init__.py
index 7a82667d..f7c32b3b 100644
--- a/pyrogram/client/methods/users/__init__.py
+++ b/pyrogram/client/methods/users/__init__.py
@@ -16,6 +16,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see .
+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("
Date: Thu, 28 Jun 2018 19:59:53 +0200
Subject: [PATCH 024/249] Add delete_profile_photos method to docs
---
docs/source/pyrogram/Client.rst | 1 +
1 file changed, 1 insertion(+)
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
From 29d45be0a5681445c42b34bb264f2f11ea24f10d Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Thu, 28 Jun 2018 20:00:48 +0200
Subject: [PATCH 025/249] Add Photo to types list
---
docs/source/pyrogram/types/index.rst | 1 +
1 file changed, 1 insertion(+)
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
From bae7b4c85127a6d8d0caf963c441912d1140cdd8 Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Thu, 28 Jun 2018 20:02:31 +0200
Subject: [PATCH 026/249] Make Photo importable from the top level package
---
pyrogram/__init__.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pyrogram/__init__.py b/pyrogram/__init__.py
index 96fb4a76..16204830 100644
--- a/pyrogram/__init__.py
+++ b/pyrogram/__init__.py
@@ -29,8 +29,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,
From b6206b7938431a24ed81aff35eced0643a44c26e Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Thu, 28 Jun 2018 20:03:50 +0200
Subject: [PATCH 027/249] Fix small docstring issue
---
pyrogram/client/types/photo.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pyrogram/client/types/photo.py b/pyrogram/client/types/photo.py
index 39fb8d94..f5494f13 100644
--- a/pyrogram/client/types/photo.py
+++ b/pyrogram/client/types/photo.py
@@ -29,7 +29,7 @@ class Photo(Object):
date (``int``):
Date the photo was sent in Unix time
- sizes (List of :obj:`PhotoSize ):
+ sizes (List of :obj:`PhotoSize `):
Available sizes of this photo
"""
From 6943e16636c04c0a31f1418caa7396a3a4b9a0d9 Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Thu, 28 Jun 2018 20:04:46 +0200
Subject: [PATCH 028/249] Change new_chat_photo type. It is now Photo
---
pyrogram/client/types/message.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pyrogram/client/types/message.py b/pyrogram/client/types/message.py
index b9048f1e..112bc0bf 100644
--- a/pyrogram/client/types/message.py
+++ b/pyrogram/client/types/message.py
@@ -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*):
From 44442a842301069665c5d8af6e0b550687dfc6e8 Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Fri, 29 Jun 2018 01:12:08 +0200
Subject: [PATCH 029/249] Update API scheme to Layer 82
---
compiler/api/source/main_api.tl | 44 ++++++++++++++++++++++-----------
1 file changed, 30 insertions(+), 14 deletions(-)
diff --git a/compiler/api/source/main_api.tl b/compiler/api/source/main_api.tl
index d1f2fa33..9ee01cb3 100644
--- a/compiler/api/source/main_api.tl
+++ b/compiler/api/source/main_api.tl
@@ -36,7 +36,7 @@ inputMediaEmpty#9664f57f = InputMedia;
inputMediaUploadedPhoto#1e287d04 flags:# file:InputFile stickers:flags.0?Vector ttl_seconds:flags.1?int = InputMedia;
inputMediaPhoto#b3ba0635 flags:# id:InputPhoto ttl_seconds:flags.0?int = InputMedia;
inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia;
-inputMediaContact#a6e45987 phone_number:string first_name:string last_name:string = InputMedia;
+inputMediaContact#f8ab7dfb phone_number:string first_name:string last_name:string vcard:string = InputMedia;
inputMediaUploadedDocument#5b38c6c1 flags:# nosound_video:flags.3?true file:InputFile thumb:flags.2?InputFile mime_type:string attributes:Vector stickers:flags.0?Vector ttl_seconds:flags.1?int = InputMedia;
inputMediaDocument#23ab23d2 flags:# id:InputDocument ttl_seconds:flags.0?int = InputMedia;
inputMediaVenue#c13d1c11 geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string = InputMedia;
@@ -61,6 +61,7 @@ inputFileLocation#14637196 volume_id:long local_id:int secret:long = InputFileLo
inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation;
inputDocumentFileLocation#430f0724 id:long access_hash:long version:int = InputFileLocation;
inputSecureFileLocation#cbc7ee28 id:long access_hash:long = InputFileLocation;
+inputTakeoutFileLocation#29be5899 = InputFileLocation;
inputAppEvent#770656a8 time:double type:string peer:long data:string = InputAppEvent;
@@ -121,7 +122,7 @@ messageService#9e19a1f6 flags:# out:flags.1?true mentioned:flags.4?true media_un
messageMediaEmpty#3ded6320 = MessageMedia;
messageMediaPhoto#695150d7 flags:# photo:flags.0?Photo ttl_seconds:flags.2?int = MessageMedia;
messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia;
-messageMediaContact#5e7d2f39 phone_number:string first_name:string last_name:string user_id:int = MessageMedia;
+messageMediaContact#cbf24940 phone_number:string first_name:string last_name:string vcard:string user_id:int = MessageMedia;
messageMediaUnsupported#9f84f49e = MessageMedia;
messageMediaDocument#9cb070d7 flags:# document:flags.0?Document ttl_seconds:flags.2?int = MessageMedia;
messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia;
@@ -153,7 +154,7 @@ messageActionBotAllowed#abe9affe domain:string = MessageAction;
messageActionSecureValuesSentMe#1b287353 values:Vector credentials:SecureCredentialsEncrypted = MessageAction;
messageActionSecureValuesSent#d95c6154 types:Vector = MessageAction;
-dialog#e4def5db flags:# pinned:flags.2?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog;
+dialog#e4def5db flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog;
photoEmpty#2331b22d id:long = Photo;
photo#9288dd29 flags:# has_stickers:flags.0?true id:long access_hash:long date:int sizes:Vector = Photo;
@@ -163,7 +164,7 @@ photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = Phot
photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize;
geoPointEmpty#1117dd5f = GeoPoint;
-geoPoint#2049d70c long:double lat:double = GeoPoint;
+geoPoint#296f104 long:double lat:double access_hash:long = GeoPoint;
auth.checkedPhone#811ea28e phone_registered:Bool = auth.CheckedPhone;
@@ -213,6 +214,7 @@ contacts.blockedSlice#900802a1 count:int blocked:Vector users:Ve
messages.dialogs#15ba6c40 dialogs:Vector
From 666c41a79df3afdf2cf4540c389c532a8d23f25d Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Wed, 19 Sep 2018 12:13:54 +0200
Subject: [PATCH 240/249] Add missing methods to docs
---
docs/source/pyrogram/Client.rst | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/docs/source/pyrogram/Client.rst b/docs/source/pyrogram/Client.rst
index 45d40368..1cd1a072 100644
--- a/docs/source/pyrogram/Client.rst
+++ b/docs/source/pyrogram/Client.rst
@@ -57,10 +57,10 @@ Messages
edit_message_text
edit_message_caption
edit_message_reply_markup
+ edit_message_media
delete_messages
get_messages
get_history
- get_dialogs
Chats
-----
@@ -84,6 +84,8 @@ Chats
get_chat
get_chat_member
get_chat_members
+ get_chat_members_count
+ get_dialogs
Users
-----
From 9538ed85fecbf8fa106315fdb2ca6906aae1f55e Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Wed, 19 Sep 2018 13:20:36 +0200
Subject: [PATCH 241/249] Fix missing backtick
---
pyrogram/client/methods/chats/get_chat_members_count.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pyrogram/client/methods/chats/get_chat_members_count.py b/pyrogram/client/methods/chats/get_chat_members_count.py
index efe53c19..41650bdd 100644
--- a/pyrogram/client/methods/chats/get_chat_members_count.py
+++ b/pyrogram/client/methods/chats/get_chat_members_count.py
@@ -32,7 +32,7 @@ class GetChatMembersCount(BaseClient):
On success, an integer is returned.
Raises:
- :class:`Error
+ :class:`Error `
``ValueError``: If a chat_id belongs to user.
"""
peer = self.resolve_peer(chat_id)
From dcd087ba63b54095a5769833a6c75e295c7bb144 Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Wed, 19 Sep 2018 14:31:51 +0200
Subject: [PATCH 242/249] Revert "Revert "Update tgcrypto function names""
This reverts commit 0f0e757
---
pyrogram/crypto/aes.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pyrogram/crypto/aes.py b/pyrogram/crypto/aes.py
index e4fb94b1..065a5b4d 100644
--- a/pyrogram/crypto/aes.py
+++ b/pyrogram/crypto/aes.py
@@ -30,19 +30,19 @@ try:
# TODO: Use new tgcrypto function names
@classmethod
def ige256_encrypt(cls, data: bytes, key: bytes, iv: bytes) -> bytes:
- return tgcrypto.ige_encrypt(data, key, iv)
+ return tgcrypto.ige256_encrypt(data, key, iv)
@classmethod
def ige256_decrypt(cls, data: bytes, key: bytes, iv: bytes) -> bytes:
- return tgcrypto.ige_decrypt(data, key, iv)
+ return tgcrypto.ige256_decrypt(data, key, iv)
@staticmethod
def ctr256_encrypt(data: bytes, key: bytes, iv: bytearray, state: bytearray = None) -> bytes:
- return tgcrypto.ctr_encrypt(data, key, iv, state or bytearray(1))
+ return tgcrypto.ctr256_encrypt(data, key, iv, state or bytearray(1))
@staticmethod
def ctr256_decrypt(data: bytes, key: bytes, iv: bytearray, state: bytearray = None) -> bytes:
- return tgcrypto.ctr_decrypt(data, key, iv, state or bytearray(1))
+ return tgcrypto.ctr256_decrypt(data, key, iv, state or bytearray(1))
@staticmethod
def xor(a: bytes, b: bytes) -> bytes:
From 6ce71b404fa8109285ce8cd3ea98aeddfb3c49a7 Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Wed, 19 Sep 2018 14:31:55 +0200
Subject: [PATCH 243/249] Revert "Revert "Remove TODO""
This reverts commit d2d4f55
---
pyrogram/crypto/aes.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/pyrogram/crypto/aes.py b/pyrogram/crypto/aes.py
index 065a5b4d..f16688c4 100644
--- a/pyrogram/crypto/aes.py
+++ b/pyrogram/crypto/aes.py
@@ -27,7 +27,6 @@ try:
class AES:
- # TODO: Use new tgcrypto function names
@classmethod
def ige256_encrypt(cls, data: bytes, key: bytes, iv: bytes) -> bytes:
return tgcrypto.ige256_encrypt(data, key, iv)
From 0f6e5ef29810dd4b89151a1c6e8c1b5b13f2bffe Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Wed, 19 Sep 2018 14:35:45 +0200
Subject: [PATCH 244/249] Use a stricter tgcrypto version requirement
---
setup.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.py b/setup.py
index b8d5c274..ee0fed9b 100644
--- a/setup.py
+++ b/setup.py
@@ -172,7 +172,7 @@ setup(
packages=find_packages(exclude=["compiler*"]),
zip_safe=False,
install_requires=read("requirements.txt"),
- extras_require={"tgcrypto": ["tgcrypto>=1.0.4"]},
+ extras_require={"tgcrypto": ["tgcrypto==1.1.0"]},
cmdclass={
"clean": Clean,
"generate": Generate
From 9ef8c786e47438cdf3628fb545e3647840b4f3b6 Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Wed, 19 Sep 2018 16:23:33 +0200
Subject: [PATCH 245/249] Update tgcrypto required version
---
setup.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.py b/setup.py
index ee0fed9b..10789e98 100644
--- a/setup.py
+++ b/setup.py
@@ -172,7 +172,7 @@ setup(
packages=find_packages(exclude=["compiler*"]),
zip_safe=False,
install_requires=read("requirements.txt"),
- extras_require={"tgcrypto": ["tgcrypto==1.1.0"]},
+ extras_require={"tgcrypto": ["tgcrypto==1.1.1"]},
cmdclass={
"clean": Clean,
"generate": Generate
From 08f6d0b865480146724f9e8aa3dbe3071b78e0bf Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Wed, 19 Sep 2018 16:24:30 +0200
Subject: [PATCH 246/249] Fix tgcrypto version in docs index page
---
docs/source/index.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/source/index.rst b/docs/source/index.rst
index 0f8a6bf0..6e740dd0 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -29,7 +29,7 @@ Welcome to Pyrogram
alt="Scheme Layer">
-
From 3a858e6a57c36df41e2b843358c51b7919fa1a67 Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Wed, 19 Sep 2018 17:30:23 +0200
Subject: [PATCH 247/249] Fix config values not being available when not using
config.ini file
---
pyrogram/client/client.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py
index 1f25c537..3d8911a7 100644
--- a/pyrogram/client/client.py
+++ b/pyrogram/client/client.py
@@ -916,6 +916,8 @@ class Client(Methods, BaseClient):
option,
fallback=getattr(Client, option.upper())
))
+ else:
+ setattr(self, option, getattr(Client, option.upper()))
if self._proxy:
self._proxy["enabled"] = True
From da92a79b3c1f50559a1e9e04a886d0203297e8b1 Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Wed, 19 Sep 2018 17:47:14 +0200
Subject: [PATCH 248/249] Update README.rst
---
README.rst | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/README.rst b/README.rst
index 0b9efb76..db2957c3 100644
--- a/README.rst
+++ b/README.rst
@@ -26,7 +26,7 @@ Features
- **Easy to use**: You can easily install Pyrogram using pip and start building your app right away.
- **High-level**: The low-level details of MTProto are abstracted and automatically handled.
- **Fast**: Crypto parts are boosted up by TgCrypto_, a high-performance library written in pure C.
-- **Updated** to the latest Telegram API version, currently Layer 81 on top of MTProto 2.0.
+- **Updated** to the latest Telegram API version, currently Layer 82 on top of MTProto 2.0.
- **Documented**: The Pyrogram API is well documented and resembles the Telegram Bot API.
- **Full API**, allowing to execute any advanced action an official client is able to do, and more.
@@ -78,14 +78,13 @@ Copyright & License
Telegram MTProto API Client Library for Python
-
+
Download
@@ -100,25 +99,25 @@ Copyright & License
-
-
-.. |logo| image:: https://pyrogram.ml/images/logo.png
+.. |logo| image:: https://raw.githubusercontent.com/pyrogram/logos/master/logos/pyrogram_logo2.png
:target: https://pyrogram.ml
:alt: Pyrogram
.. |description| replace:: **Telegram MTProto API Client Library for Python**
-.. |scheme| image:: "https://img.shields.io/badge/SCHEME-LAYER%2081-eda738.svg?longCache=true&style=for-the-badge&colorA=262b30"
+.. |scheme| image:: "https://img.shields.io/badge/SCHEME-LAYER%2082-eda738.svg?longCache=true&style=for-the-badge&colorA=262b30"
:target: compiler/api/source/main_api.tl
:alt: Scheme Layer
-.. |tgcrypto| image:: "https://img.shields.io/badge/TGCRYPTO-V1.0.4-eda738.svg?longCache=true&style=for-the-badge&colorA=262b30"
+.. |tgcrypto| image:: "https://img.shields.io/badge/TGCRYPTO-V1.1.1-eda738.svg?longCache=true&style=for-the-badge&colorA=262b30"
:target: https://github.com/pyrogram/tgcrypto
:alt: TgCrypto
From cc47897c6889712158dea83718ad4f2c0bded9c3 Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Wed, 19 Sep 2018 17:47:28 +0200
Subject: [PATCH 249/249] Update to v0.8.0
---
pyrogram/__init__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pyrogram/__init__.py b/pyrogram/__init__.py
index 1de05f2c..a1107ee1 100644
--- a/pyrogram/__init__.py
+++ b/pyrogram/__init__.py
@@ -23,7 +23,7 @@ __copyright__ = "Copyright (C) 2017-2018 Dan Tès