From c4a41adae591154915804eaf23b53c0e6599b941 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Thu, 4 May 2023 19:05:07 +0200 Subject: [PATCH] Better document breaking ToS will lead to bans Closes #4102. --- README.rst | 4 ++++ readthedocs/quick-references/faq.rst | 20 ++++++++++++++++++++ telethon/client/auth.py | 7 ++++--- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index dbb56295..bef2c36e 100755 --- a/README.rst +++ b/README.rst @@ -12,6 +12,8 @@ as a user or through a bot account (bot API alternative). If you have code using Telethon before its 1.0 version, you must read `Compatibility and Convenience`_ to learn how to migrate. + As with any third-party library for Telegram, be careful not to + break `Telegram's ToS`_ or `Telegram can ban the account`_. What is this? ------------- @@ -76,6 +78,8 @@ useful information. .. _MTProto: https://core.telegram.org/mtproto .. _Telegram: https://telegram.org .. _Compatibility and Convenience: https://docs.telethon.dev/en/stable/misc/compatibility-and-convenience.html +.. _Telegram's ToS: https://core.telegram.org/api/terms +.. _Telegram can ban the account: https://docs.telethon.dev/en/stable/quick-references/faq.html#my-account-was-deleted-limited-when-using-the-library .. _Read The Docs: https://docs.telethon.dev .. |logo| image:: logo.svg diff --git a/readthedocs/quick-references/faq.rst b/readthedocs/quick-references/faq.rst index adf56727..19eff266 100644 --- a/readthedocs/quick-references/faq.rst +++ b/readthedocs/quick-references/faq.rst @@ -60,6 +60,16 @@ And except them as such: My account was deleted/limited when using the library ===================================================== +First and foremost, **this is not a problem exclusive to Telethon. +Any third-party library is prone to cause the accounts to appear banned.** +Even official applications can make Telegram ban an account under certain +circumstances. Third-party libraries such as Telethon are a lot easier to +use, and as such, they are misused to spam, which causes Telegram to learn +certain patterns and ban suspicious activity. + +There is no point in Telethon trying to circumvent this. Even if it succeeded, +spammers would then abuse the library again, and the cycle would repeat. + The library will only do things that you tell it to do. If you use the library with bad intentions, Telegram will hopefully ban you. @@ -75,6 +85,16 @@ would fail. To solve these connection problems, you should use a proxy. Telegram may also ban virtual (VoIP) phone numbers, as again, they're likely to be used for spam. +More recently (year 2023 onwards), Telegram has started putting a lot more +measures to prevent spam (with even additions such as anonymous participants +in groups or the inability to fetch group members at all). This means some +of the anti-spam measures have gotten more aggressive. + +The recommendation has usually been to use the library only on well-established +accounts (and not an account you just created), and to not perform actions that +could be seen as abuse. Telegram decides what those actions are, and they're +free to change how they operate at any time. + If you want to check if your account has been limited, simply send a private message to `@SpamBot`_ through Telegram itself. You should notice this by getting errors like ``PeerFloodError``, diff --git a/telethon/client/auth.py b/telethon/client/auth.py index be1f591a..9ca5b458 100644 --- a/telethon/client/auth.py +++ b/telethon/client/auth.py @@ -238,13 +238,14 @@ class AuthMethods: me = await self.sign_in(phone=phone, password=password) # We won't reach here if any step failed (exit by exception) - signed, name = 'Signed in successfully as', utils.get_display_name(me) + signed, name = 'Signed in successfully as ', utils.get_display_name(me) + tos = '; remember to not break the ToS or you will risk an account ban!' try: - print(signed, name) + print(signed, name, tos, sep='') except UnicodeEncodeError: # Some terminals don't support certain characters print(signed, name.encode('utf-8', errors='ignore') - .decode('ascii', errors='ignore')) + .decode('ascii', errors='ignore'), tos, sep='') return self