2016-12-08 03:52:37 +00:00
|
|
|
var discord = require('discord.js');
|
|
|
|
var app = require('../app.js');
|
|
|
|
var data = require('../data.js');
|
|
|
|
var logger = require('../logging.js');
|
|
|
|
var UserBan = require('../models/UserBan.js');
|
|
|
|
|
2017-04-07 23:17:05 +00:00
|
|
|
exports.roles = ['Admins', 'Moderators', 'CitraBot'];
|
2016-12-08 03:52:37 +00:00
|
|
|
exports.command = function(message) {
|
|
|
|
message.mentions.users.map((user) => {
|
2016-12-31 05:48:39 +00:00
|
|
|
var count = app.warnings.filter(x => x.id == user.id && !x.cleared).length || 0;
|
2016-12-08 03:52:37 +00:00
|
|
|
|
2017-04-07 23:17:05 +00:00
|
|
|
message.channel.sendMessage(`${user} ${user.username}, You will now be banned from this channel.`);
|
|
|
|
logger.info(`${message.author.toString()} has banned ${user.toString()} ${user} ${user.username}.`);
|
|
|
|
app.logChannel.sendMessage(`${message.author} has banned ${user} ${user.username} [${count}].`);
|
2016-12-08 03:52:37 +00:00
|
|
|
|
2016-12-31 05:48:39 +00:00
|
|
|
app.bans.push(new UserBan(user.id, user.username, message.author.id, message.author.username, count));
|
2016-12-08 03:52:37 +00:00
|
|
|
|
|
|
|
message.guild.member(user).ban().catch(function (error) {
|
2017-04-07 23:17:05 +00:00
|
|
|
app.logChannel.sendMessage(`Error banning ${user} ${user.username}`);
|
|
|
|
logger.error(`Error banning ${user.toString()} ${user} ${user.username}.`, error);
|
2016-12-08 03:52:37 +00:00
|
|
|
});
|
2017-07-20 01:45:58 +00:00
|
|
|
|
2016-12-08 03:52:37 +00:00
|
|
|
data.flushBans();
|
|
|
|
});
|
|
|
|
}
|