modify status based on what the bot is doing
This commit is contained in:
parent
a50d93f058
commit
9088813f54
1 changed files with 10 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
||||||
exports.run = async (client, message, args, level) => {
|
|
||||||
message.delete();
|
message.delete();
|
||||||
|
client.user.setStatus("idle");
|
||||||
|
|
||||||
let response = await client.awaitReply(message, "**Are you sure you want to shut me down?** Respond with \`yes\` to proceed.");
|
let response = await client.awaitReply(message, "**Are you sure you want to shut me down?** Respond with \`yes\` to proceed.");
|
||||||
message.author.lastMessage.delete();
|
message.author.lastMessage.delete();
|
||||||
|
@ -7,20 +7,29 @@ exports.run = async (client, message, args, level) => {
|
||||||
|
|
||||||
if(response === "yes") {
|
if(response === "yes") {
|
||||||
await msg.edit(`**Confirmed by ${message.author}.** Shutting down...`);
|
await msg.edit(`**Confirmed by ${message.author}.** Shutting down...`);
|
||||||
|
|
||||||
|
client.user.setStatus("dnd");
|
||||||
|
|
||||||
await Promise.all(client.commands.map(cmd =>
|
await Promise.all(client.commands.map(cmd =>
|
||||||
client.unloadCommand(cmd)
|
client.unloadCommand(cmd)
|
||||||
));
|
));
|
||||||
await msg.edit(`Successfully shut down by ${message.author}.`);
|
await msg.edit(`Successfully shut down by ${message.author}.`);
|
||||||
|
|
||||||
|
client.user.setStatus("invisible");
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
} else if(response === "no") {
|
} else if(response === "no") {
|
||||||
await msg.edit(`**Shutdown cancelled by ${message.author}.** This message will be removed in 5 seconds.`).then(msg => {
|
await msg.edit(`**Shutdown cancelled by ${message.author}.** This message will be removed in 5 seconds.`).then(msg => {
|
||||||
msg.delete(5000)
|
msg.delete(5000)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
client.user.setStatus("online");
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
await msg.edit(`**${message.author} has provided an invalid response**; shutdown aborted. This message will be deleted in 5 seconds.`).then(msg => {
|
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)
|
msg.delete(5000)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
client.user.setStatus("online");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue