Fix upload_keys

This commit is contained in:
Patrick Neff 2020-08-06 19:47:25 +02:00
parent da1e1df6df
commit 6f1f9c598d
1 changed files with 6 additions and 4 deletions

View File

@ -129,8 +129,7 @@ class Bot(object):
return self.__client return self.__client
async def __upload_keys(self) -> None: async def __upload_keys(self) -> None:
if self.client.should_upload_keys: await self.client.keys_upload()
await self.client.keys_upload()
if self.client.should_query_keys: if self.client.should_query_keys:
await self.client.keys_query() await self.client.keys_query()
@ -141,9 +140,12 @@ class Bot(object):
async def sync(self) -> None: async def sync(self) -> None:
self.logger.debug('Starting sync') self.logger.debug('Starting sync')
next_batch = self.__read_next_batch()
await self.__upload_keys() await self.__upload_keys()
await self.client.sync(timeout=30000, full_state=True) await self.client.sync(timeout=30000,
full_state=True,
since=next_batch)
async def sync_forever(self) -> None: async def sync_forever(self) -> None:
# next_batch = self.__read_next_batch() # next_batch = self.__read_next_batch()
@ -159,7 +161,7 @@ class Bot(object):
self.logger.debug('Adding callbacks') self.logger.debug('Adding callbacks')
client.add_to_device_callback(self.__to_device_callback, client.add_to_device_callback(self.__to_device_callback,
(KeyVerificationEvent, )) (KeyVerificationEvent, ))
self.__upload_keys() await self.__upload_keys()
click.secho('\nStarting verification process...', click.secho('\nStarting verification process...',
bold=True, bold=True,
fg='green') fg='green')