Answers for "discord.js kick member"

4

discord.js kick user

let member = message.mentions.members.first();
if(!member) return message.reply("Please mention a valid member of this server");
if(!member.kickable) return message.reply("I cannot kick this member!");

member.kick(); //.kick(reason) if you would to put in the reason through arguments
Posted by: Guest on January-15-2021
1

discord.js how to kick a user

let member = message.mentions.members.first();
if(!member) message.reply("Please mention a valid member of this server") return;
if(!member.kickable) message.reply("This member is not kickable") return;
// Now check if the user has the Kick Members Permission
if(!member.hasPermission('KICK_MEMBERS') {
   message.reply("You Can't kick anyone");
	return;
} else {
 // Now If they do kick the user
  member.kick();
}
// If this works please upvote!
Posted by: Guest on July-13-2021
0

Discord.js ban command

if (msg.member.hasPermission("BAN_MEMBERS")) {
    if (msg.members.mentions.first()) {
        try {
            msg.members.mentions.first().ban();
        } catch {
            msg.reply("I do not have permissions to ban" + msg.members.mentions.first());
        }
    } else {
        msg.reply("You do not have permissions to ban" + msg.members.mentions.first());
    }
}
Posted by: Guest on January-12-2021
-1

Discord.js ban command

if (msg.member.hasPermission("KICK_MEMBERS")) {
    if (msg.members.mentions.first()) {
        try {
            msg.members.mentions.first().kick();
        } catch {
            msg.reply("I do not have permissions to kick " + msg.members.mentions.first());
        }
    } else {
        msg.reply("You do not have permissions to kick " + msg.members.mentions.first());
    }
}
Posted by: Guest on January-12-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language