2019-12-21 20:58:58 +00:00
|
|
|
exports.run = async (client, message, args, level) => {
|
2019-12-11 18:45:24 +00:00
|
|
|
message.delete();
|
2019-12-21 20:55:14 +00:00
|
|
|
client.user.setStatus("idle");
|
2019-12-11 18:45:24 +00:00
|
|
|
|
|
|
|
let response = await client.awaitReply(message, "**Are you sure you want to shut me down?** Respond with \`yes\` to proceed.");
|
|
|
|
message.author.lastMessage.delete();
|
|
|
|
let msg = client.user.lastMessage;
|
|
|
|
|
|
|
|
if(response === "yes") {
|
|
|
|
await msg.edit(`**Confirmed by ${message.author}.** Shutting down...`);
|
2019-12-21 20:55:14 +00:00
|
|
|
|
|
|
|
client.user.setStatus("dnd");
|
|
|
|
|
2019-11-26 21:22:24 +00:00
|
|
|
await Promise.all(client.commands.map(cmd =>
|
|
|
|
client.unloadCommand(cmd)
|
|
|
|
));
|
2019-12-11 18:45:24 +00:00
|
|
|
await msg.edit(`Successfully shut down by ${message.author}.`);
|
2019-12-21 20:55:14 +00:00
|
|
|
|
|
|
|
client.user.setStatus("invisible");
|
2019-11-26 21:22:24 +00:00
|
|
|
process.exit(0);
|
2019-12-11 18:45:24 +00:00
|
|
|
} else if(response === "no") {
|
|
|
|
await msg.edit(`**Shutdown cancelled by ${message.author}.** This message will be removed in 5 seconds.`).then(msg => {
|
|
|
|
msg.delete(5000)
|
|
|
|
});
|
2019-12-21 20:55:14 +00:00
|
|
|
|
|
|
|
client.user.setStatus("online");
|
2019-12-11 18:45:24 +00:00
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
await msg.edit(`**${message.author} has provided an invalid response**; shutdown aborted. This message will be deleted in 5 seconds.`).then(msg => {
|
|
|
|
msg.delete(5000)
|
|
|
|
});
|
2019-12-21 20:55:14 +00:00
|
|
|
|
|
|
|
client.user.setStatus("online");
|
2019-12-11 18:45:24 +00:00
|
|
|
return;
|
2019-11-26 21:22:24 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.conf = {
|
|
|
|
enabled: true,
|
|
|
|
guildOnly: false,
|
|
|
|
aliases: [],
|
|
|
|
permLevel: "Bot Owner"
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.help = {
|
|
|
|
name: "shutdown",
|
|
|
|
category: "System",
|
|
|
|
description: "Shuts down the bot.",
|
|
|
|
usage: "shutdown"
|
|
|
|
};
|