mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-04 13:40:59 +03:00
Fix most private messages being outgoing since 56ddaae
56ddaae
checked to_id and from_id to compare if they were equal,
and if they were, mark the event as outgoing for convenience in
your private chat (saved messages).
However when reconstructing the Message from UpdateShortMessage
to_id didn't mimic 100% Telegram's behaviour (the chat to which
the message is sent is "different" depending on who sent the
messages). This bug is what actually caused most messages to
be outgoing, even though 56ddaae's logic is correct.
This commit is contained in:
parent
8d98c04932
commit
1a1d9d346c
|
@ -88,7 +88,11 @@ class NewMessage(EventBuilder):
|
|||
media_unread=update.media_unread,
|
||||
silent=update.silent,
|
||||
id=update.id,
|
||||
to_id=types.PeerUser(update.user_id),
|
||||
# Note that to_id/from_id complement each other in private
|
||||
# messages, depending on whether the message was outgoing.
|
||||
to_id=types.PeerUser(
|
||||
update.user_id if update.out else self._self_id
|
||||
),
|
||||
from_id=self._self_id if update.out else update.user_id,
|
||||
message=update.message,
|
||||
date=update.date,
|
||||
|
|
Loading…
Reference in New Issue
Block a user