How do I restart my bot?

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!

1 Like

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.

1 Like

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 @dexterateed ,
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!

3 Likes