Add missing checks in the message for is client None

This commit is contained in:
Lonami Exo
2019-05-02 18:44:28 +02:00
parent b58c0d3071
commit 1a00de6494
3 changed files with 32 additions and 21 deletions

View File

@@ -49,7 +49,7 @@ class ChatGetter(abc.ABC):
Note that this might not be available if the library doesn't
have enough information available.
"""
if self._input_chat is None and self._chat_peer:
if self._input_chat is None and self._chat_peer and self._client:
try:
self._input_chat = self._client._entity_cache[self._chat_peer]
except KeyError:
@@ -62,7 +62,7 @@ class ChatGetter(abc.ABC):
Returns `input_chat`, but will make an API call to find the
input chat unless it's already cached.
"""
if self.input_chat is None and self.chat_id:
if self.input_chat is None and self.chat_id and self._client:
try:
# The chat may be recent, look in dialogs
target = self.chat_id