mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-03 05:04:33 +03:00
Stop setting the sender to be the channel when missing
This commit is contained in:
parent
010ee0813a
commit
232e76e73a
|
@ -494,6 +494,10 @@ empty media.
|
||||||
|
|
||||||
The ``telethon.tl.patched`` hack has been removed.
|
The ``telethon.tl.patched`` hack has been removed.
|
||||||
|
|
||||||
|
The message sender no longer is the channel when no sender is provided by Telegram. Telethon used
|
||||||
|
to patch this value for channels to be the same as the chat, but now it will be faithful to
|
||||||
|
Telegram's value.
|
||||||
|
|
||||||
In order to avoid breaking more code than strictly necessary, ``.raw_text`` will remain a synonym
|
In order to avoid breaking more code than strictly necessary, ``.raw_text`` will remain a synonym
|
||||||
of ``.message``, and ``.text`` will still be the text formatted through the ``client.parse_mode``.
|
of ``.message``, and ``.text`` will still be the text formatted through the ``client.parse_mode``.
|
||||||
However, you're encouraged to change uses of ``.raw_text`` with ``.message``, and ``.text`` with
|
However, you're encouraged to change uses of ``.raw_text`` with ``.message``, and ``.text`` with
|
||||||
|
|
|
@ -410,13 +410,6 @@ class Message(ChatGetter, SenderGetter):
|
||||||
if isinstance(message, _tl.Message):
|
if isinstance(message, _tl.Message):
|
||||||
if message.from_id is not None:
|
if message.from_id is not None:
|
||||||
sender_id = utils.get_peer_id(message.from_id)
|
sender_id = utils.get_peer_id(message.from_id)
|
||||||
if sender_id is None and message.peer_id and not isinstance(message, _tl.MessageEmpty):
|
|
||||||
# If the message comes from a Channel, let the sender be it
|
|
||||||
# ...or...
|
|
||||||
# incoming messages in private conversations no longer have from_id
|
|
||||||
# (layer 119+), but the sender can only be the chat we're in.
|
|
||||||
if message.post or (not message.out and isinstance(message.peer_id, _tl.PeerUser)):
|
|
||||||
sender_id = utils.get_peer_id(message.peer_id)
|
|
||||||
|
|
||||||
# Note that these calls would reset the client
|
# Note that these calls would reset the client
|
||||||
ChatGetter.__init__(self, message.peer_id, broadcast=message.post)
|
ChatGetter.__init__(self, message.peer_id, broadcast=message.post)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user