#Command to stop the bot?

1 messages · Page 1 of 1 (latest)

blazing grove
#

Is there a command to stop the bot like discord.Client.logout in discord.py?

strange phoenixBOT
#

Hey! Once your issue is solved, press the button below to close this thread!

civic palm
#

And it doesn't close the session, so honestly, just don't shut it down via the bot. Or if you really need to shut it down using OS.

blazing grove
#

Indeed, every time I force quit, the json file is unreadable...
By shut off the bot manually, do you mean Ctrl+C?

civic palm
#

Yep, but I mean, it's not much better than bot.stop.

#

What do you mean json file is unreadable?

#

Btw i may not be able to provide amazing support as im new to interactions.py too, however I've tried many other types of python discord bots and this one is the easiest and most powerful one i've found yet especially with easily integradable / commands.

blazing grove
rocky finch
#

if you want to simulate a Ctrl+C in your code, you can raise the KeyboardInterrupt exception

#

I don't think the bot.stop function should be called to stop the bot, I think it's a private function for the inner workings of the bot

blazing grove
#

I'm running the bot with nohup on Ubuntu, so it's hard to do Ctrl+C...

rocky finch
#

Idk what is nohup but I think you misunderstood me

#

raise the exception, not manually press Ctrl C

stray rampart
#

no its a public function lmao

#

if we wanted it private it would be underscored

#

using it is perfectly fine

rocky finch
#

oh ok nice

#

maybe it was this way in v4

stray rampart
#

v4 was more picky about it, but v5 doesnt care

rancid pine
#

stop() is the recommended way to do it, because it means you can put cleanup after the eventloop ends

#

ctrl+C will force-quit on the current line, not allowing cleanup functions to run

stray rampart
#

(though usually ipy intercepts the first control c and tries to close it gracefully using stop)