So I am making a Discord bot but I don’t know how to make it restart. I can’t find any code that explains it anywhere. for the project, please DM me on Discord. DEMONITIZED BOI#1991
This is due to the project being private for safety. Thanks!
So I am making a Discord bot but I don’t know how to make it restart. I can’t find any code that explains it anywhere. for the project, please DM me on Discord. DEMONITIZED BOI#1991
This is due to the project being private for safety. Thanks!
You can go into the console and type refresh
and your bot will restart. If you want to stop the bot, you can simply break the package.json file, then make the edits and revert the package.json file.
Thanks! I will try that
It worked! Thanks. I will keep this in mind.
You can mark my reply as the solution and get this thread closed. Welcome, by the way.
Hey @Demonitized ,
Here is the easiest way to do that, using a script:
process.exit(1);
My restart bot command:
if (message.content === 'restartthebot') {
if (message.author.id !== 'Owners ID') return;
message.channel.send('Restarted.').then(() => {
process.exit(1);
})
};
Thanks and cheers!
How do I access the console, because while the bot is running(Mine uses discord.py in python), I can’t type anything in the console?
Welcome to the forums @NewDeveloper911! What is labelled as the console in the editor actually just outputs errors, messages and things like that, to run commands like refresh
you need to go into the terminal.
when I type refresh in the terminal it says zsh: command not found: refresh
I don’t know the answer to your shell question but having seen the thread it is attached to I’m happy to have the opportunity to offer the following:
I think typing refresh is among the worst ways to restart a bot and “break the package.json file” is absolutely the worst way to stop a bot.
refresh
only works in the glitch editor - if you’re working locally you can just cancel the process with ctrl + c and then rerun the command. If you are working on glitch then that’s a very odd error and I can’t help you