mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-10 19:46:36 +03:00
Fix incoming private messages not working with whitelists
For some reason this was only happening with bots and not actual private messages. The fix doesn't seem to affect previous behaviour with actual users in private messages.
This commit is contained in:
parent
3b0ab7794b
commit
9604161c91
|
@ -277,7 +277,14 @@ class NewMessage(_EventBuilder):
|
|||
Whether the message is a reply to some other or not.
|
||||
"""
|
||||
def __init__(self, message):
|
||||
super().__init__(chat_peer=message.to_id,
|
||||
if not message.out and isinstance(message.to_id, types.PeerUser):
|
||||
# Incoming message (e.g. from a bot) has to_id=us, and
|
||||
# from_id=bot (the actual "chat" from an user's perspective).
|
||||
chat_peer = types.PeerUser(message.from_id)
|
||||
else:
|
||||
chat_peer = message.to_id
|
||||
|
||||
super().__init__(chat_peer=chat_peer,
|
||||
msg_id=message.id, broadcast=bool(message.post))
|
||||
|
||||
self.message = message
|
||||
|
|
Loading…
Reference in New Issue
Block a user