我对这个 discord.py 很陌生.我刚刚做了一个 discord.py 机器人,它工作正常,但有时机器人会不断重复命令消息.我用谷歌搜索了这个问题,发现可能是为了一遍又一遍地运行脚本(比如在编辑或添加功能后保存并运行时).所以我想停止运行该进程,就像当我重新启动 Windows 时,机器人处于脱机状态(如果我在重新启动 Windows 后运行脚本,机器人会正常运行).请帮忙
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...
但是,在使用此代码保存机器人后,您可能需要重新启动 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()
我希望这对你有用并且我可以提供帮助.
I hope this works for you and that I could help.
这篇关于如何停止运行不和谐的机器人进程(python)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!