Edit message after exit process

I want my bot to post a message before restarting (inside of a restart command). I want it to edit that same message again after it’s done. How could I achieve this? Thanks! This is my code:

message.channel.send("⏳ Checking...").then(msg => {
      if (message.author.id == "<my discord id lol>") {
        msg.edit("⌛ Restarting...")
        setTimeout(() => {
          process.exit();
        }, 1000);
        //here I want it to show the restart has been successful.
      } else {
        msg.edit(
          "<message that shows up when not the bot owner>"
        );
      }

Don’t think thats possible as the process is exited

You could save the message ID to a database before process.exit() and then check for that database entry on startup.

1 Like