Update to layer 152

This commit is contained in:
Lonami Exo
2023-02-05 15:05:05 +01:00
parent 9f077e356b
commit 6dece6e8a1
2 changed files with 62 additions and 17 deletions

View File

@@ -524,6 +524,10 @@ class AuthMethods:
return await self.send_code_request(
phone, force_sms=force_sms, _retry_count=_retry_count+1)
# TODO figure out when/if/how this can happen
if isinstance(result, types.auth.SentCodeSuccess):
raise RuntimeError('logged in right after sending the code')
# If we already sent a SMS, do not resend the code (hash may be empty)
if isinstance(result.type, types.auth.SentCodeTypeSms):
force_sms = False
@@ -550,6 +554,9 @@ class AuthMethods:
return await self.send_code_request(
phone, force_sms=False, _retry_count=_retry_count+1)
if isinstance(result, types.auth.SentCodeSuccess):
raise RuntimeError('logged in right after resending the code')
self._phone_code_hash[phone] = result.phone_code_hash
return result