Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(cmd === `${prefix}ban`){
- let member = message.mentions.members.first() || message.guild.members.get(args[0]);
- if(!message.member.hasPermission("BAN_MEMBERS")){
- const permissionembed = new Discord.RichEmbed()
- .setTitle(` Error! `)
- .setDescription(`Can't Execute Command`)
- .setTimestamp()
- .addField(`***Reason:***`, `You do not have permission to use this command`)
- .setColor("#db1a09")
- .setFooter(`Popuko Tutorial | Ban command`);
- message.channel.send(permissionembed);
- }else{
- if(!member){
- const mentionembed = new Discord.RichEmbed()
- .setTitle(` Error! `)
- .setDescription(`Can't Execute Command`)
- .addField(`***Reason:***`, "Please Mention an Valid Member of this server!")
- .addField(`Example`, "!ban @user reason")
- .setTimestamp()
- .setColor(`#db1a09`)
- .setFooter(`Popuko Tutorial | Ban Command`);
- message.channel.send(mentionembed)
- }
- if(!member.bannable) {
- const cantbanembed = new Discord.RichEmbed()
- .setTitle(` Error! `)
- .setDescription("I cannot ban this user")
- .addField(`***Reason: ***`, `User has an Higher role, Or i do not have enough perms to`)
- .setTimestamp()
- .setColor("#db1a09")
- .setFooter(`Popuko Tutorial | Ban Command`);
- message.channel.send(cantbanembed);
- }else {
- const logs = message.guild.channels.find(channel => channel.name === "plogs");
- if(message.guild.me.hasPermission('MANAGE_CHANNELS') && !logs) {
- message.guild.createChannel('logs', 'text');
- }
- let reason = args.slice(1).join(' ');
- if(!reason) reason = "No reason provided";
- member.ban(reason)
- .catch(error => message.channel.send(`Sorry ${message.author} I couldn't find the user`));
- const banembed = new Discord.RichEmbed()
- .setTitle(`🔨 User Banned `)
- .setDescription(`${member.user.tag} has been banned`)
- .addField(`Moderator`, `${message.author.tag}`)
- .addField(`Reason:`, `${reason}`)
- .setTimestamp()
- .setFooter(`Popuko Tutorial | Ban Command`);
- message.channel.send(`🔨 User has been banned`);
- logs.send(banembed);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement