This repository has been archived by the owner on Aug 2, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
cmd_kick.js
32 lines (29 loc) · 1.57 KB
/
cmd_kick.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// good solution amirite
module.exports = function(msg, bot, args) {
if (args) {
if (msg.member.permission.has("kickMembers") == true) { // check perms
if(msg.mentions[0].id == msg.member.id){ // dont let commit kick
bot.createMessage(msg.channel.id, ":x: ``You cant kick **yourself**, lol! :smiley:``")
} else {
console.log(msg.mentions[0])
var person2kick = msg.guild.members.find(fn => fn.id == msg.mentions[0].id);
if (person2kick.permission.has("kickMembers" || "banMembers")) { //A BUSE
bot.createMessage(msg.channel.id, ":x: ``You cant kick a fellow moderator! (yet)``")
} else {
console.log(args.slice(msg.mentions[0].id.length+3))
if(args.slice(msg.mentions[0].id.length+4).size > 2) {
person2kick.kick("Kicked by: "+msg.member.username+" for "+args.slice(msg.mentions[0].id.length+3))
bot.createMessage(msg.channel.id, "``**"+person2kick.username+"** Has been kicked by **"+msg.member.username+"** for: **"+args.slice(msg.mentions[0].id.length+3)+"**``")
} else {
person2kick.kick("Kicked by: "+msg.member.username+" for: reason was not provided")
bot.createMessage(msg.channel.id, "``**"+person2kick.username+"** Has been kicked by **"+msg.member.username+"** for: **No reason provided!**``")
}
}
}
} else {
bot.createMessage(msg.channel.id, ":x: ``You dont have the permissions to this!``");
}
} else {
bot.createMessage(msg.channel.id, ":x: ``You have to mention whoever you want to kick!``")
}
}