mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-04 05:34:41 +03:00
Let sender = chat for messages from channels
This commit is contained in:
parent
ae085f30a8
commit
4e5b8c9c34
|
@ -185,6 +185,10 @@ class Message(ChatGetter, SenderGetter, TLObject, abc.ABC):
|
||||||
else:
|
else:
|
||||||
self._chat_peer = to_id
|
self._chat_peer = to_id
|
||||||
|
|
||||||
|
if post and not from_id and self._chat_peer:
|
||||||
|
# If the message comes from a Channel, let the sender be it
|
||||||
|
self._sender_id = utils.get_peer_id(self._chat_peer)
|
||||||
|
|
||||||
self._broadcast = post
|
self._broadcast = post
|
||||||
self._chat = None
|
self._chat = None
|
||||||
self._input_chat = None
|
self._input_chat = None
|
||||||
|
|
|
@ -14,8 +14,8 @@ class SenderGetter(abc.ABC):
|
||||||
@property
|
@property
|
||||||
def sender(self):
|
def sender(self):
|
||||||
"""
|
"""
|
||||||
Returns the :tl:`User` that created this object. It may be ``None``
|
Returns the :tl:`User` or :tl:`Channel` that sent this object.
|
||||||
if the object has no sender or if Telegram didn't send the sender.
|
It may be ``None`` if Telegram didn't send the sender.
|
||||||
|
|
||||||
If you're using `telethon.events`, use `get_sender` instead.
|
If you're using `telethon.events`, use `get_sender` instead.
|
||||||
"""
|
"""
|
||||||
|
@ -37,7 +37,7 @@ class SenderGetter(abc.ABC):
|
||||||
@property
|
@property
|
||||||
def input_sender(self):
|
def input_sender(self):
|
||||||
"""
|
"""
|
||||||
This :tl:`InputPeer` is the input version of the user who
|
This :tl:`InputPeer` is the input version of the user/channel who
|
||||||
sent the message. Similarly to `input_chat`, this doesn't have
|
sent the message. Similarly to `input_chat`, this doesn't have
|
||||||
things like username or similar, but still useful in some cases.
|
things like username or similar, but still useful in some cases.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user