From ab150bf457612ad97276026cfd1f3636d9de2986 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Fri, 18 Feb 2022 19:09:14 +0100 Subject: [PATCH] Fix get_tos usage of expiry expires is actually a timestamp, not seconds --- telethon/_client/auth.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/telethon/_client/auth.py b/telethon/_client/auth.py index 518abc8d..4a4ec1d4 100644 --- a/telethon/_client/auth.py +++ b/telethon/_client/auth.py @@ -6,6 +6,7 @@ import sys import typing import warnings import functools +import time import dataclasses 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: result = await self(_tl.fn.help.GetTermsOfServiceUpdate()) 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 return _custom.TermsOfService._new(self, *self._tos)