1

I am using the telethon-API to access the telegram-API for some network analysis over multiple groups. As I didn't quite understand how the spam-protection works I tried to test the limits of when telegram stops me from sending requests. I executed the following code-snippet (accidently without an await, so basically 200 requests immediately).

for i in range(100):
    client.get_messages(g, limit=None)
    client.get_participants(g)

Almost immediately I received an error: SessionRevokedError: The authorization has been invalidated, because of the user terminating all sessions (caused by GetHistoryRequest). I was logged out not only with my application but also on my smartphone and any telegram-web/desktop sessions I had open.

While I could login again on my smartphone, telegram-web and even through the telethon-api, once I send any other request like client.get_dialogs(), I was immediately logged out of any device again.

Looking back, it might have been a bad idea but I continued trying logging in and getting kicked in different ways all to the same result.

Today, about 20 hours later I tried logging in again. I was kicked again same as yesterday but now I am quickly kicked out of the smartphone app when I try to enter my phone-number and confirmation (without even accessing any api).

I tried logging in again after multiple hours with enough time for the original requests to have been processed and deleting the .session-db from telethon.

I basically have three questions:

  1. Anyone has any idea, what happened to my account and if this is just temporary / What I can do to restore it to normal behaviour?
  2. Can I somehow check the 'status' of my account, as I don't really understand what exactly is happening to it?
  3. Does anyone know of a guide or publications by telegram on how the spam-protection works?

Thank you very much for your help!

HannoChan
  • 11
  • 2

1 Answers1

0

accidently without an await, so basically 200 requests immediately

This is not how async works in Python. If you don't await a call to an async def, it won't run at all (unless you had imported the telethon.sync hack which puts the await for you).

Anyone has any idea, what happened to my account and if this is just temporary / What I can do to restore it to normal behaviour?

If you're still getting "SessionRevokedError", your account might be compromised, as far as I'm aware, this only occurs when a logged-in client revokes the session. However Telegram may have introduced this error in other circumstances, in which case, no idea.

Can I somehow check the 'status' of my account, as I don't really understand what exactly is happening to it?

You can message @SpamBot or contact support, but that's about it.

Does anyone know of a guide or publications by telegram on how the spam-protection works?

Telegram can change these limits at any time, and can be based on a lot of conditions that would be impossible to know without reading the server's source code. As long as you don't clearly misuse the API, you should be fine.

Lonami
  • 5,945
  • 2
  • 20
  • 38
  • Thanks for the extensive answer! I'm still struggling with the same issue. I've contacted the @SpamBot and it tells me that my account has no restrictions in place. Nevertheless when I run the following code: `client = TelegramClient('anon', api_id, api_hash)` `await client.start()` `dialogs = await client.get_dialogs(limit=10)` I immediately receive: "telethon.errors.rpcerrorlist.SessionRevokedError: The authorization has been invalidated, because of the user terminating all sessions (caused by GetDialogsRequest)" – HannoChan Dec 05 '22 at 09:38
  • I just tried the same code on another device in the same network and it worked without any issues. Maybe Telegram blacklisted this specific device? – HannoChan Dec 05 '22 at 10:18
  • It could be. I am not experienced in these types of limitations. – Lonami Dec 09 '22 at 18:10