Jas*_*ngh 4 python-3.x telegram python-telegram-bot telegram-bot telethon
我没有使用机器人 API。我正在使用 Telegram API 发送消息。消息很容易发送,但问题出现在 19 个用户之后。在第 20 个用户上,我收到 PeerFloodError。即使在搜索了很多之后,我也没有找到任何特定的限制,并且使用 sleep 也不起作用。请提出一种克服这个问题的方法。
def send_message(root2, client):
totalcount = 0
for user in users:
if totalcount >= len(users):
root2.destroy()
break
if totalcount % 15 == 0 and totalcount != 0:
print("Waiting for one minute...")
time.sleep(60)
if user not in users2 or user not in users3:
totalcount += 1
entity = client.get_entity(user)
client.send_message(entity, message_str)
time.sleep(8)
Run Code Online (Sandbox Code Playgroud)
most of the Telegram APIs have strict limits for each of 30-seconds, 30-minutes, 24-hours periods. spread 19(or less API calls in 30 minutes and catch whether it throws an error or not, if it's doing fine after 30minutes: Great! otherwise, do this process for 24 hours.)
请注意,对于大量使用 Telegram API,您可能需要在项目中使用多个帐户。
| 归档时间: |
|
| 查看次数: |
8320 次 |
| 最近记录: |