From 2c61c506712994aac5d358d873cb1ce2cb592ffe Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Wed, 24 Oct 2018 16:39:59 +0200 Subject: [PATCH] Save session on connect and fix some typos The session is saved upon connecting with the hope to make sure that the authorization key gets saved to disk before the next run. --- readthedocs/extra/examples/telegram-client.rst | 2 +- telethon/client/telegrambaseclient.py | 1 + telethon_examples/assistant.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/readthedocs/extra/examples/telegram-client.rst b/readthedocs/extra/examples/telegram-client.rst index 4c26edd6..d5516a07 100644 --- a/readthedocs/extra/examples/telegram-client.rst +++ b/readthedocs/extra/examples/telegram-client.rst @@ -501,7 +501,7 @@ For instance, let's imagine ``you`` are the bot talking to ``usr``: ? Your name didn't have any letters! Try again Lonami - Thanks! + Thanks Lonami! This can be programmed as follows: diff --git a/telethon/client/telegrambaseclient.py b/telethon/client/telegrambaseclient.py index 2846bed6..22a5ac29 100644 --- a/telethon/client/telegrambaseclient.py +++ b/telethon/client/telegrambaseclient.py @@ -313,6 +313,7 @@ class TelegramBaseClient(abc.ABC): loop=self._loop, proxy=self._proxy )) self.session.auth_key = self._sender.auth_key + self.session.save() await self._sender.send(self._init_with( functions.help.GetConfigRequest())) diff --git a/telethon_examples/assistant.py b/telethon_examples/assistant.py index 6fba1eff..e8e8b2db 100644 --- a/telethon_examples/assistant.py +++ b/telethon_examples/assistant.py @@ -351,7 +351,7 @@ async def handler(event): for i in range(1, 4) ] what = max(rates, key=lambda t: t[1]) - if what[1] < 0.7: + if what[1] < 0.75: return name = what[0]