mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-06-18 02:56:39 +00:00
Fix handling of early edits in Conversation
The incoming messages were never updated, so of course their edit_date wasn't either. This would cause the library to be stuck until it timed out, because the event had already arrived before we waited for it. As an example: await conv.send_message('foo') await sleep(1) # bot has plenty of time to respond+edit await conv.get_edit()
This commit is contained in:
parent
4a8b19b0be
commit
0a3d164806
@ -333,6 +333,12 @@ class Conversation(ChatGetter):
|
|||||||
if message.chat_id != self.chat_id or message.out:
|
if message.chat_id != self.chat_id or message.out:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# We have to update our incoming messages with the new edit date
|
||||||
|
for i, m in enumerate(self._incoming):
|
||||||
|
if m.id == message.id:
|
||||||
|
self._incoming[i] = message
|
||||||
|
break
|
||||||
|
|
||||||
for msg_id, future in list(self._pending_edits.items()):
|
for msg_id, future in list(self._pending_edits.items()):
|
||||||
if msg_id < message.id:
|
if msg_id < message.id:
|
||||||
edit_ts = message.edit_date.timestamp()
|
edit_ts = message.edit_date.timestamp()
|
||||||
|
Loading…
Reference in New Issue
Block a user