Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cqhttp能设置个延时回复吗 #2495

Open
q-sue opened this issue Nov 16, 2023 · 5 comments
Open

cqhttp能设置个延时回复吗 #2495

q-sue opened this issue Nov 16, 2023 · 5 comments

Comments

@q-sue
Copy link

q-sue commented Nov 16, 2023

发现机器人回复太快会封号,有办法加个随机延时吗

@LengYue12138
Copy link

用随机数和休眠自己写一个随机延时就好了

@q-sue
Copy link
Author

q-sue commented Nov 16, 2023 via email

@LengYue12138
Copy link

加到发送消息的方法里面,每次发消息前休眠一段随机时间

@Thexiaoyuqaq
Copy link

自己代码上加上延迟
比如python
time.sleep(1)

@Lambholl
Copy link

Lambholl commented Nov 25, 2023

自己代码上加上延迟 比如python time.sleep(1)

这样操作的话,建议别直接写在路由绑定的那个函数里面,因为http请求response还是第一时间返回去比较好,可以用_thread单开一个线程,先把回复消息的操作写在另一个函数里面,然后用修饰器修饰的那个函数里面,收到请求就开新线程,直接return掉,操作的那个函数里面加上time.sleep,会比较好。
不过开新线程的话,用php是不行咯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants