Fix issues with to/from ID in private chats with multiple clients

This should address #1218.
This commit is contained in:
Lonami Exo
2019-08-07 00:46:19 +02:00
parent b1eed82b7f
commit 45d82f2a85
11 changed files with 26 additions and 19 deletions

View File

@@ -383,6 +383,12 @@ class UpdateMethods:
except OSError:
pass # We were disconnected, that's okay
if not self._self_input_peer:
# Some updates require our own ID, so we must make sure
# that the event builder has offline access to it. Calling
# `get_me()` will cache it under `self._self_input_peer`.
await self.get_me(input_peer=True)
built = EventBuilderDict(self, update, others)
for conv_set in self._conversations.values():
for conv in conv_set:
@@ -539,7 +545,9 @@ class EventBuilderDict:
try:
return self.__dict__[builder]
except KeyError:
event = self.__dict__[builder] = builder.build(self.update, self.others)
event = self.__dict__[builder] = builder.build(
self.update, self.others, self.client._self_input_peer.user_id)
if isinstance(event, EventCommon):
event.original_update = self.update
event._entities = self.update._entities