From e05a5ebf6f5a3e353992b7370437c657f1cc7b59 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 28 Mar 2019 14:01:16 +0100 Subject: [PATCH 1/2] Fix core types not being printed because of missing __slots__ --- pyrogram/api/core/future_salt.py | 4 ++++ pyrogram/api/core/future_salts.py | 4 ++++ pyrogram/api/core/gzip_packed.py | 4 ++++ pyrogram/api/core/message.py | 4 ++++ pyrogram/api/core/msg_container.py | 4 ++++ 5 files changed, 20 insertions(+) diff --git a/pyrogram/api/core/future_salt.py b/pyrogram/api/core/future_salt.py index bce01dc8..4ee8197b 100644 --- a/pyrogram/api/core/future_salt.py +++ b/pyrogram/api/core/future_salt.py @@ -26,6 +26,10 @@ from .primitives import Int, Long class FutureSalt(Object): ID = 0x0949d9dc + __slots__ = ["valid_since", "valid_until", "salt"] + + QUALNAME = "FutureSalt" + def __init__(self, valid_since: int or datetime, valid_until: int or datetime, salt: int): self.valid_since = valid_since self.valid_until = valid_until diff --git a/pyrogram/api/core/future_salts.py b/pyrogram/api/core/future_salts.py index bddfdb47..cf6a9902 100644 --- a/pyrogram/api/core/future_salts.py +++ b/pyrogram/api/core/future_salts.py @@ -27,6 +27,10 @@ from .primitives import Int, Long class FutureSalts(Object): ID = 0xae500895 + __slots__ = ["req_msg_id", "now", "salts"] + + QUALNAME = "FutureSalts" + def __init__(self, req_msg_id: int, now: int or datetime, salts: list): self.req_msg_id = req_msg_id self.now = now diff --git a/pyrogram/api/core/gzip_packed.py b/pyrogram/api/core/gzip_packed.py index 8b26be9d..135c36bf 100644 --- a/pyrogram/api/core/gzip_packed.py +++ b/pyrogram/api/core/gzip_packed.py @@ -26,6 +26,10 @@ from .primitives import Int, Bytes class GzipPacked(Object): ID = 0x3072cfa1 + __slots__ = ["packed_data"] + + QUALNAME = "GzipPacked" + def __init__(self, packed_data: Object): self.packed_data = packed_data diff --git a/pyrogram/api/core/message.py b/pyrogram/api/core/message.py index 35459ef8..5b2e5b64 100644 --- a/pyrogram/api/core/message.py +++ b/pyrogram/api/core/message.py @@ -25,6 +25,10 @@ from .primitives import Int, Long class Message(Object): ID = 0x5bb8e511 # hex(crc32(b"message msg_id:long seqno:int bytes:int body:Object = Message")) + __slots__ = ["msg_id", "seq_no", "length", "body"] + + QUALNAME = "Message" + def __init__(self, body: Object, msg_id: int, seq_no: int, length: int): self.msg_id = msg_id self.seq_no = seq_no diff --git a/pyrogram/api/core/msg_container.py b/pyrogram/api/core/msg_container.py index 4373498d..bfc41333 100644 --- a/pyrogram/api/core/msg_container.py +++ b/pyrogram/api/core/msg_container.py @@ -26,6 +26,10 @@ from .primitives import Int class MsgContainer(Object): ID = 0x73f1f8dc + __slots__ = ["messages"] + + QUALNAME = "MsgContainer" + def __init__(self, messages: list): self.messages = messages From e79f4fde80db5f37a5c6b96e080af16a62e2554c Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 28 Mar 2019 14:01:38 +0100 Subject: [PATCH 2/2] Fix send_chat_action not working with upload_* actions --- pyrogram/client/methods/messages/send_chat_action.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyrogram/client/methods/messages/send_chat_action.py b/pyrogram/client/methods/messages/send_chat_action.py index cdd61df3..04777d42 100644 --- a/pyrogram/client/methods/messages/send_chat_action.py +++ b/pyrogram/client/methods/messages/send_chat_action.py @@ -62,7 +62,7 @@ class SendChatAction(BaseClient): action = action.value if "Upload" in action.__name__: - action = action(progress) + action = action(progress=progress) else: action = action()