From a03a8673e1e89e9f391833188f91f657eaf8d1f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?mart=C3=ADn?= Date: Sun, 2 Mar 2025 18:40:34 +0000 Subject: [PATCH] Clarify warning when reusing unintended session (#4568) --- telethon/client/auth.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/telethon/client/auth.py b/telethon/client/auth.py index 52d671ac..425789a9 100644 --- a/telethon/client/auth.py +++ b/telethon/client/auth.py @@ -147,14 +147,16 @@ class AuthMethods: if bot_token[:bot_token.find(':')] != str(me.id): warnings.warn( 'the session already had an authorized user so it did ' - 'not login to the bot account using the provided ' - 'bot_token (it may not be using the user you expect)' + 'not login to the bot account using the provided bot_token; ' + 'if you were expecting a different user, check whether ' + 'you are accidentally reusing an existing session' ) elif phone and not callable(phone) and utils.parse_phone(phone) != me.phone: warnings.warn( 'the session already had an authorized user so it did ' - 'not login to the user account using the provided ' - 'phone (it may not be using the user you expect)' + 'not login to the user account using the provided phone; ' + 'if you were expecting a different user, check whether ' + 'you are accidentally reusing an existing session' ) return self