nodbot/commands/kill.js

24 lines
619 B
JavaScript
Raw Normal View History

2021-06-29 01:42:14 +00:00
const ownerID = process.env.ownerID;
module.exports = {
name: 'kill',
description: 'Kills the bot OWNER ONLY',
execute(message, args) {
if (message.author.id == ownerID) {
message.channel.send('Shutting down the bot...')
.then(() => {
message.client.destroy();
process.exit();
});
} else {
message.reply('Sorry, only the owner can do that.');
message.client.users.fetch(ownerID)
.then(user => {
user.send(message.author.username + ' attempted to shutdown the bot.')
.then()
.catch(err => console.error(err));
})
.catch(err => console.error(err));
}
}
}