Partially upgrade to layer 119

This commit is contained in:
Lonami Exo
2020-10-01 09:17:18 +02:00
parent 10b2b60415
commit 62737c1caf
2 changed files with 74 additions and 40 deletions

View File

@@ -62,7 +62,7 @@ class Message(ChatGetter, SenderGetter, TLObject, abc.ABC):
legacy (`bool`):
Whether this is a legacy message or not.
to_id (:tl:`Peer`):
peer_id (:tl:`Peer`):
The peer to which this message was sent, which is either
:tl:`PeerUser`, :tl:`PeerChat` or :tl:`PeerChannel`. This
will always be present except for empty messages.
@@ -81,12 +81,12 @@ class Message(ChatGetter, SenderGetter, TLObject, abc.ABC):
The message action object of the message for :tl:`MessageService`
instances, which will be `None` for other types of messages.
from_id (`int`):
The ID of the user who sent this message. This will be
`None` if the message was sent in a broadcast channel.
from_id (:tl:`Peer`):
The peer who sent this message, which is either
:tl:`PeerUser`, :tl:`PeerChat` or :tl:`PeerChannel`.
reply_to_msg_id (`int`):
The ID to which this message is replying to, if any.
reply_to (`int`):
The original reply header if this message is replying to another.
fwd_from (:tl:`MessageFwdHeader`):
The original forward header if this message is a forward.
@@ -147,11 +147,11 @@ class Message(ChatGetter, SenderGetter, TLObject, abc.ABC):
self, id,
# Common to Message and MessageService (mandatory)
to_id=None, date=None,
peer_id=None, date=None,
# Common to Message and MessageService (flags)
out=None, mentioned=None, media_unread=None, silent=None,
post=None, from_id=None, reply_to_msg_id=None,
post=None, from_id=None, reply_to=None,
# For Message (mandatory)
message=None,
@@ -160,13 +160,14 @@ class Message(ChatGetter, SenderGetter, TLObject, abc.ABC):
fwd_from=None, via_bot_id=None, media=None, reply_markup=None,
entities=None, views=None, edit_date=None, post_author=None,
grouped_id=None, from_scheduled=None, legacy=None,
edit_hide=None, restriction_reason=None,
edit_hide=None, restriction_reason=None, forwards=None,
replies=None,
# For MessageAction (mandatory)
action=None):
# Common properties to all messages
self.id = id
self.to_id = to_id
self.peer_id = peer_id
self.date = date
self.out = out
self.mentioned = mentioned
@@ -174,7 +175,7 @@ class Message(ChatGetter, SenderGetter, TLObject, abc.ABC):
self.silent = silent
self.post = post
self.from_id = from_id
self.reply_to_msg_id = reply_to_msg_id
self.reply_to = reply_to
self.message = message
self.fwd_from = fwd_from
self.via_bot_id = via_bot_id
@@ -191,6 +192,8 @@ class Message(ChatGetter, SenderGetter, TLObject, abc.ABC):
self.legacy = legacy
self.edit_hide = edit_hide
self.restriction_reason = restriction_reason
self.forwards = forwards
self.replies = replies
self.action = action
# Convenient storage for custom functions
@@ -206,12 +209,12 @@ class Message(ChatGetter, SenderGetter, TLObject, abc.ABC):
self._via_input_bot = None
self._action_entities = None
if not out and isinstance(to_id, types.PeerUser):
if not out and isinstance(peer_id, types.PeerUser):
chat_peer = types.PeerUser(from_id)
if from_id == to_id.user_id:
if from_id == peer_id.user_id:
self.out = not self.fwd_from # Patch out in our chat
else:
chat_peer = to_id
chat_peer = peer_id
# Note that these calls would reset the client
ChatGetter.__init__(self, chat_peer, broadcast=post)