Skip to content
Snippets Groups Projects
Commit 88f9e97f authored by Levatax's avatar Levatax
Browse files

Added kick command

parent 934a3f4b
Branches
No related tags found
No related merge requests found
const Discord = require('discord.js');
exports.run = async(bot, message, args, connection) => {
let user = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
let reason = args.slice(1).join(' ');
if(!user) return message.channel.send('Please mention user to kick.');
if(!reason) return message.channel.send('Please type a reason and try again');
if (!message.guild.member(user).kickable) return message.reply(`I don't have permission to kick this user`);
console.log(user.user.tag);
user.kick({reason: reason});
const embed = new Discord.RichEmbed()
.setColor('RANDOM')
.setTimestamp()
.addField('Punishment:', 'Kick From Server')
.addField('Kicked User:', `${user.user.tag} (${user.id})`)
.addField('Moderator:', `${message.author.tag} (${message.author.id})`)
.addField('Reason:', reason);
message.channel.send(embed);
var sql = `INSERT INTO punishments (type,guild,user,admin,duration,reason,channel) VALUES ('Kick','${message.guild.id}','${user.id}','${message.member.id}','-','${reason}','${message.channel.id}')`;
connection.query(sql, function (err, result) {
if (err) throw err;
console.log('successfully added to sql');
});
};
module.exports.help = {
name: 'kick',
aliases: ['']
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment