Created
February 16, 2018 02:39
-
-
Save sirhypernova/0409f7ac1e6ac529089d1af70b6dc531 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (msg.member.hasPermission('BAN_MEMBERS')) { | |
if (msg.mentions.members.size) { | |
var member = msg.mentions.members.first(); | |
if (msg.args[0] == member.toString()) { | |
if (member.bannable && (msg.member.highestRole.position > member.highestRole.position || msg.author.id == msg.guild.ownerID)) { | |
if (msg.args[2]) { | |
var purgeLength = (parseInt(msg.args[1])>0?parseInt(msg.args[1]):0); | |
msg.args.splice(0,2); | |
member.user.send(`You have been banned from \`${msg.guild.name}\` by \`${msg.author.tag}\` with the reason \`${msg.args.join(' ')}\``) | |
.then(()=>{ | |
member.ban({reason: `Banned by ${msg.author.tag}, with reason: ${msg.args.join(' ')}.`,days: purgeLength}, purgeLength).then(()=>{ | |
msg.channel.send(`Banned ${member.user.tag} successfully! (Reason: \`${msg.args.join(' ')}\`)`); | |
}).catch(); | |
}); | |
} else { | |
var purgeLength = (parseInt(msg.args[1])>0?parseInt(msg.args[1]):0); | |
member.user.send(`You have been banned from \`${msg.guild.name}\` by \`${msg.author.tag}\` with no reason specified.`) | |
.then(()=>{ | |
member.ban({reason: `Banned by ${msg.author.tag}, with no reason.`,days: purgeLength}).then(()=>{ | |
msg.channel.send(`Banned ${member.user.tag} successfully!`); | |
}).catch(); | |
}); | |
} | |
} else { | |
msg.channel.send('Sorry! I cannot ban that user.'); | |
} | |
} else { | |
msg.channel.send('The first argument must be a mention.'); | |
} | |
} else { | |
msg.channel.send(`Usage: \`${module.exports.usage(prefix)}\``); | |
} | |
} else { | |
msg.channel.send('Sorry! You do not have permission to use this command!'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment