我没有使用机器人API。我正在使用Telegram API发送消息。消息很容易发送,但问题发生在19个用户之后。在第20个用户时,我收到PeerFloodError。即使在搜索了很多次之后,我也没有找到任何特定的限制,使用睡眠也不起作用。请建议一种解决此问题的方法。
代码
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)
发布于 2018-10-08 06:31:17
大多数Telegram API对每个30秒、30分钟、24小时的时段都有严格的限制。在30分钟内传播19个(或更少的API调用,并捕捉它是否抛出错误,如果它在30分钟后运行良好:太棒了!否则,请将此过程持续24小时。)
请注意,对于批量使用Telegram API,您可能需要在项目中使用多个帐户。
https://stackoverflow.com/questions/52691651
复制相似问题