Add files via upload
This commit is contained in:
18
bot/commands/banIP.js
Normal file
18
bot/commands/banIP.js
Normal file
@ -0,0 +1,18 @@
|
||||
module.exports = {
|
||||
command: 'banip',
|
||||
description: 'Ban an IP Address from your service',
|
||||
syntax: '{PREFIX}banip [IP_ADDRESS]',
|
||||
execute: async (_this, msg, args) => {
|
||||
if (!args.join(' ')) return msg.channel.createMessage('No arguments were given');
|
||||
const ipAddress = args.join(' ');
|
||||
const exists = _this.db.get('bans').find({ ip: ipAddress }).value();
|
||||
if (exists === undefined) {
|
||||
msg.channel.createMessage(`Banning IP \`${ipAddress}\`...`);
|
||||
_this.db.get('bans')
|
||||
.push({ ip: ipAddress })
|
||||
.write();
|
||||
} else {
|
||||
msg.channel.createMessage('This IP Address is already banned');
|
||||
}
|
||||
},
|
||||
};
|
Reference in New Issue
Block a user