Fix utils.get_peer not handling Self in get_messages

This commit is contained in:
Lonami Exo 2020-10-23 19:02:43 +02:00
parent 44e2ef6c79
commit 1a2e09487c
3 changed files with 7 additions and 3 deletions

View File

@ -290,7 +290,7 @@ class _IDsIter(RequestIter):
else:
r = await self.client(functions.messages.GetMessagesRequest(ids))
if self._entity:
from_id = utils.get_peer(self._entity)
from_id = await self.client._get_peer(self._entity)
if isinstance(r, types.messages.MessagesNotModified):
self.buffer.extend(None for _ in ids)
@ -804,7 +804,7 @@ class MessageMethods:
if isinstance(result, types.UpdateShortSentMessage):
message = types.Message(
id=result.id,
peer_id=utils.get_peer(entity),
peer_id=await self.client.get_peer(entity),
message=message,
date=result.date,
out=result.out,

View File

@ -463,6 +463,10 @@ class UserMethods:
.format(peer)
)
async def _get_peer(self: 'TelegramClient', peer: 'hints.EntityLike'):
i, cls = utils.resolve_id(await self.get_peer_id(peer))
return cls(i)
async def get_peer_id(
self: 'TelegramClient',
peer: 'hints.EntityLike',

View File

@ -1,3 +1,3 @@
# Versions should comply with PEP440.
# This line is parsed in setup.py:
__version__ = '1.17.1'
__version__ = '1.17.2'