Adding log channel and kill command
This commit is contained in:
parent
d8eff85d58
commit
05b16f3f6d
24
commands/kill.js
Normal file
24
commands/kill.js
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,7 @@
|
|||||||
{
|
{
|
||||||
"prefix": "/",
|
"prefix": "/",
|
||||||
"serverID": "760701839427108874"
|
"serverID": "760701839427108874",
|
||||||
|
"logChannel": "858449941911437353",
|
||||||
|
"bootMessage": "NodBot v2 Starting Up",
|
||||||
|
"shutdownMessage": "NodBot v2 Shutting Down"
|
||||||
}
|
}
|
11
index.js
11
index.js
@ -7,7 +7,7 @@ const client = new Discord.Client();
|
|||||||
|
|
||||||
const debug = true;
|
const debug = true;
|
||||||
// const config = require('./config.json');
|
// const config = require('./config.json');
|
||||||
const { prefix } = require('./config.json');
|
const { prefix, logChannel, bootMessage, shutdownMessage } = require('./config.json');
|
||||||
|
|
||||||
// const owner = process.env.ownerID;
|
// const owner = process.env.ownerID;
|
||||||
const giphy = require('giphy-api')(process.env.giphyAPIKey);
|
const giphy = require('giphy-api')(process.env.giphyAPIKey);
|
||||||
@ -20,6 +20,13 @@ client.once('ready', () => {
|
|||||||
functions.getCommandFiles(client);
|
functions.getCommandFiles(client);
|
||||||
functions.getGifFiles(client);
|
functions.getGifFiles(client);
|
||||||
functions.getPastaFiles(client);
|
functions.getPastaFiles(client);
|
||||||
|
client.channels.fetch(logChannel)
|
||||||
|
.then(channel => {
|
||||||
|
channel.send(bootMessage)
|
||||||
|
.then()
|
||||||
|
.catch(err => console.error(err));
|
||||||
|
})
|
||||||
|
.catch(err => console.error(err));
|
||||||
});
|
});
|
||||||
|
|
||||||
client.login(process.env.TOKEN);
|
client.login(process.env.TOKEN);
|
||||||
@ -77,7 +84,7 @@ client.on('message', message => {
|
|||||||
if (!client.pastas.has(file[0])) {
|
if (!client.pastas.has(file[0])) {
|
||||||
message.reply('Sorry I couldn\'t find that gif.');
|
message.reply('Sorry I couldn\'t find that gif.');
|
||||||
} else {
|
} else {
|
||||||
message.channel.send(client.pastas.get(file[0]).content);
|
message.channel.send(client.pastas.get(file[0]).content, { split: { char: ' ' } });
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user