Add restart command

This commit is contained in:
Ecolipsy 2021-12-12 15:56:37 +01:00
parent 9200527450
commit a5515493b8

View file

@ -161,6 +161,10 @@ client.on("ready", () => {
required: true
}
]
},
{
name: "restart",
description: "Restarts the bot."
}
]).then(cmds => {
console.log("Finished loading all commands");
@ -299,6 +303,12 @@ client.on("interactionCreate", (int) => {
int.reply("An unexpected error has occured: ```js\n" + e.stack + "```");
});
});
} else if(int.commandName == "restart"){
var devs = readJson("worthy.json");
if(!devs.devlist.includes(int.user.id)) return int.reply(":x: Access denied");
int.reply("Restarting...").then(msg => {
process.exit(69420);
});
}
} else if(int.isButton()){
if(int.customId.startsWith("cat")){
@ -326,3 +336,9 @@ client.on("interactionCreate", (int) => {
}
}
});
process.on("exit", (code) => {
console.log("Exiting with code", code);
client.destroy();
});