Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
866 views
in Technique[技术] by (71.8m points)

sublimetext3 - How to stop running discord bot process (python)

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: I made the bot exact as a tutorial...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
  • If you add the code that I wrote down there (that only the owner can use) will shut down the already running bots (write /shutdown in discord server or whatever your prefix is).

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()
  • So every time if you want to edit your command, you write /shutdown and edit it, after that, you can start it again.

I hope this works for you and that I could help.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...