LonamiWebs / Telethon

Pure Python 3 MTProto API Telegram client library, for bots too!
https://docs.telethon.dev
MIT License
9.97k stars 1.4k forks source link

Getting user limited by Telegram for DM sends - guidelines? #397

Closed dsldsl closed 6 years ago

dsldsl commented 7 years ago

I'm having a different-but-similar issue as issue 297 -- it's more of a Telegram API / spam block issue. I'm unsure how to get support from them, so wanted to ask this community.

(Is there a good place to get Telegram support for questions around how to stay within guidelines and not get user limited for sending DMs?)

I am an admin in a large superchat room. We’re working to help protect our users from fraud by having our team members reach out 1:1 to make sure they know to watch out for scammers. We’re using the Telethon to help id and DM message users we think may be at risk. I've followed different patterns with a few different admins and all get limited after around 50 DMs. I think that we’re just hitting some automated spam filter or rate limit (vs user reporting) because the users we message all seem very engaged and appreciative.

Specifically, the error is:

telethon.errors.rpc_errors.RPCError: PEER_FLOOD (code 400)

Thank you for any tips or directional guidance!

Lonami commented 7 years ago

Is there a good place to get Telegram support for questions around how to stay within guidelines and not get user limited for sending DMs

The rules are mostly simple: don't talk to strangers as they can report you, and don't add strangers to groups or channels as they can report you too.

We’re using the Telethon to help id and DM message users we think may be at risk.

That itself may be risky. Perhaps the best option would just be to mention them in the group to warn them, after all, they should have the mention button to jump to the mention and see your warning, without risking them to block whatever account you're using.

I think that we’re just hitting some automated spam filter or rate limit (vs user reporting)

Hm, I have no idea about that so perhaps it could be that way. But if it exists, I'm unaware of it.

telethon.errors.rpc_errors.RPCError: PEER_FLOOD (code 400)

Consider upgrading, the error should now be PeerFloodError.

ghost commented 7 years ago

please suggest, how to except the error and go on with the program?

Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner self.run() File "/usr/lib/python3.5/threading.py", line 862, in run self._target(*self._args, **self._kwargs) File "main.py", line 67, in monitorandsend result = client.send_message(adtarget,tgmessage) File "/home/kali/.local/lib/python3.5/site-packages/telethon/telegram_client.py", line 369, in send_message result = self(request) File "/home/kali/.local/lib/python3.5/site-packages/telethon/telegram_bare_client.py", line 461, in __call__ sender, call_receive, update_state, *requests File "/home/kali/.local/lib/python3.5/site-packages/telethon/telegram_bare_client.py", line 518, in _invoke raise next(x.rpc_error for x in requests if x.rpc_error) telethon.errors.rpc_error_list.PeerFloodError

Lonami commented 7 years ago

Well currently there's no way to globally capture the errors unless you define your custom function and use that instead. You see, the library can't know your control flow or what you would want to do in certain cases so I can't just "go on with the program". I'm open for suggestions though.

ghost commented 7 years ago

kk thx figured it

from telethon.errors.rpc_error_list import PeerFloodError

except PeerFloodError:
    print('EXCEPTION')
Lonami commented 6 years ago

More on this as the wiki link on #297 is now broken: http://telethon.readthedocs.io/en/latest/extra/troubleshooting/deleted-limited-or-deactivated-accounts.html.

ogcrypto commented 6 years ago

Sorry, you can only send messages to mutual contacts at the moment. More info » Click for technical details

please help me i keep on getting this issue even when the time i was promise my account will be release

jjhesk commented 5 years ago

how to avoid this error?

Lonami commented 5 years ago

The link from https://github.com/LonamiWebs/Telethon/issues/397#issuecomment-357892498 is (again) broken, the new one is https://docs.telethon.dev/en/latest/quick-references/faq.html#my-account-was-deleted-limited-when-using-the-library.