我该如何在运行且尚未完成时呼叫停止循环?
使用不和谐本身的文本触发CTRL+C?
即使尚未完成,我如何将Close()与Discord的文本一起停止WALE循环?
如何使用Discord的文本停止客户端(token)?
Triggering Ctrl+C with a text from Discord itself?
How can I use close() with a text from Discord to stop the while loop even if it is not finished yet?
How can I stop client.run(TOKEN) with a text from Discord?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用Sigint信号,这是Control-C时的信号。请参阅在这里有关更多信息。然后,您可以将机器人发送到本身:
然后,如果您需要停止机器人,则可以
do_control_c_interrupt()
内部。You can use the SIGINT signal, which is the signal when you Control-C. See here for more information. You can then get the bot to send the signal to itself:
Then, you can
do_control_c_interrupt()
inside of a command if you need to stop the bot.