如何停止运行Discord Bot进程(Python) [英] How to stop running discord bot process (python)
问题描述
这个不和谐的东西是我的新手。我刚刚做了一个discord.py机器人,它可以正常工作,但有时该机器人会不断重复命令消息。
我搜索了这个问题,发现可能是一遍又一遍地运行脚本(例如,在编辑或添加函数后保存并运行)。
因此,我想停止运行该进程,就像重新启动Windows一样,该bot处于脱机状态(如果在重新启动Windows之后运行脚本,该bot会正常运行)。
Pls帮助
Im new at this discord.py thing. I've just done a discord.py bot, it works ok, but sometimes the bot repeats constantly the command messages. I googled this problem and found out that maybe is for running the script over and over again (like when you save and run after edited or added functions). So I want to stop running the process, just like when I restart windows, the bot is offline (if I run the script after restarting windows, the bot acts normaly). Pls help
如果有人需要代码,我可以将其粘贴在这里。
If someone needs the code, I can paste it here then.
PD :我将机器人程序作为教程进行了精确修改...
PD: I made the bot exact as a tutorial...
推荐答案
- 如果您添加了我在那写下来(只有拥有者可以使用
)将关闭已经运行的机器人(在
不和谐服务器中写入 / shutdown 或其他命令)您的前缀是)。
但是,在使用该代码保存漫游器之后,您可能需要重新启动PC。
However, you may need a PC restart after saving the bot with this code.
@client.command()
@commands.is_owner()
async def shutdown(ctx):
await ctx.bot.logout()
- 所以每次都想编辑命令,编写/ shutdown并对其进行编辑,之后,您可以再次启动它。
我希望这对您有用并且我可以帮忙。
I hope this works for you and that I could help.
这篇关于如何停止运行Discord Bot进程(Python)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!