-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Code that causes the issue
After starting a bot with a valid token, Telethon correctly connects and authorizes.
However, if the bot token is later:
Revoked (via BotFather),
The bot is deleted,
Or banned by Telegram,
Lines of code:
Telethon/telethon/client/updates.py
Line 262 in e77307d
was_once_logged_in = self._authorized is True or not self._message_box.is_empty() |
Telethon/telethon/client/updates.py
Line 323 in e77307d
if was_once_logged_in: |
Telethon/telethon/client/updates.py
Line 366 in e77307d
if was_once_logged_in: |
Expected behavior
If the bot gets unauthorized after original auth, (was_once_logged_in). It should disconnect
Actual behavior
It just prints in the log (Cannot get difference since the account is not logged in .....) and still keep the connection
Traceback
xxxx-xx-xx xx:xx:xx,xxx- telethon.client.updates - INFO - Cannot get difference since the account is not logged in: SessionRevokedError
Telethon version
1.40.0
Python version
3.11.13
Operating system (including distribution name and version)
Windows 11, Ubuntu 22.04
Other details
No response
Checklist
- The error is in the library's code, and not in my own.
- I have searched for this issue before posting it and there isn't an open duplicate.
- I ran
pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zip
and triggered the bug in the latest version.