Add restart command
This commit is contained in:
parent
9200527450
commit
a5515493b8
1 changed files with 16 additions and 0 deletions
16
index.js
16
index.js
|
@ -161,6 +161,10 @@ client.on("ready", () => {
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "restart",
|
||||||
|
description: "Restarts the bot."
|
||||||
}
|
}
|
||||||
]).then(cmds => {
|
]).then(cmds => {
|
||||||
console.log("Finished loading all commands");
|
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 + "```");
|
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()){
|
} else if(int.isButton()){
|
||||||
if(int.customId.startsWith("cat")){
|
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();
|
||||||
|
});
|
Loading…
Reference in a new issue