mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-26 03:13:45 +03:00
Fix is_user_authorized always returning True
This commit is contained in:
parent
8d5c052fce
commit
cfa5cd0db2
|
@ -222,7 +222,10 @@ class TelegramBaseClient(abc.ABC):
|
|||
self._updates_handle = None
|
||||
self._last_request = time.time()
|
||||
self._channel_pts = {}
|
||||
self._state = types.updates.State(0, 0, datetime.now(), 0, -1)
|
||||
|
||||
# Start with invalid state (-1) so we can have somewhere to store
|
||||
# the state, but also be able to determine if we are authorized.
|
||||
self._state = types.updates.State(-1, 0, datetime.now(), 0, -1)
|
||||
|
||||
# Some further state for subclasses
|
||||
self._event_builders = []
|
||||
|
|
|
@ -90,7 +90,7 @@ class UserMethods(TelegramBaseClient):
|
|||
"""
|
||||
Returns ``True`` if the user is authorized.
|
||||
"""
|
||||
if self._self_input_peer is not None or self._state is not None:
|
||||
if self._self_input_peer is not None or self._state.pts != -1:
|
||||
return True
|
||||
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue
Block a user