mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-27 08:50:41 +03:00
Fix get_tos usage of expiry
expires is actually a timestamp, not seconds
This commit is contained in:
parent
503d0859ec
commit
ab150bf457
|
@ -6,6 +6,7 @@ import sys
|
||||||
import typing
|
import typing
|
||||||
import warnings
|
import warnings
|
||||||
import functools
|
import functools
|
||||||
|
import time
|
||||||
import dataclasses
|
import dataclasses
|
||||||
|
|
||||||
from .._misc import utils, helpers, password as pwd_mod
|
from .._misc import utils, helpers, password as pwd_mod
|
||||||
|
@ -282,7 +283,7 @@ async def get_tos(self):
|
||||||
if first_time or no_tos or tos_expired:
|
if first_time or no_tos or tos_expired:
|
||||||
result = await self(_tl.fn.help.GetTermsOfServiceUpdate())
|
result = await self(_tl.fn.help.GetTermsOfServiceUpdate())
|
||||||
tos = getattr(result, 'terms_of_service', None)
|
tos = getattr(result, 'terms_of_service', None)
|
||||||
self._tos = (tos, asyncio.get_running_loop().time() + result.expires)
|
self._tos = (tos, asyncio.get_running_loop().time() + result.expires.timestamp() - time.time())
|
||||||
|
|
||||||
# not stored in the client to prevent a cycle
|
# not stored in the client to prevent a cycle
|
||||||
return _custom.TermsOfService._new(self, *self._tos)
|
return _custom.TermsOfService._new(self, *self._tos)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user