mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 17:36:34 +03:00
Force fetch sender/chat if only min information was given
This commit is contained in:
parent
21a8a50ab9
commit
29b21209bf
|
@ -29,7 +29,9 @@ class ChatGetter(abc.ABC):
|
|||
Returns `chat`, but will make an API call to find the
|
||||
chat unless it's already cached.
|
||||
"""
|
||||
if self._chat is None and await self.get_input_chat():
|
||||
# See `get_sender` for information about 'min'.
|
||||
if (self._chat is None or getattr(self._chat, 'min', None))\
|
||||
and await self.get_input_chat():
|
||||
try:
|
||||
self._chat =\
|
||||
await self._client.get_entity(self._input_chat)
|
||||
|
|
|
@ -26,7 +26,14 @@ class SenderGetter(abc.ABC):
|
|||
Returns `sender`, but will make an API call to find the
|
||||
sender unless it's already cached.
|
||||
"""
|
||||
if self._sender is None and await self.get_input_sender():
|
||||
# ``sender.min`` is present both in :tl:`User` and :tl:`Channel`.
|
||||
# It's a flag that will be set if only minimal information is
|
||||
# available (such as display name, but username may be missing),
|
||||
# in which case we want to force fetch the entire thing because
|
||||
# the user explicitly called a method. If the user is okay with
|
||||
# cached information, they may use the property instead.
|
||||
if (self._sender is None or self._sender.min) \
|
||||
and await self.get_input_sender():
|
||||
try:
|
||||
self._sender =\
|
||||
await self._client.get_entity(self._input_sender)
|
||||
|
|
Loading…
Reference in New Issue
Block a user