1if(command === "unban"){
2 if(!msg.member.hasPermission("BAN_MEMBERS")) {
3 return msg.channel.send(`**${msg.author.username}**, You do not have perms to unban someone`)
4 }
5
6 if(!msg.guild.me.hasPermission("BAN_MEMBERS")) {
7 return msg.channel.send(`**${msg.author.username}**, I do not have perms to unban someone`)
8 }
9
10 let userID = args[0]
11 msg.guild.fetchBans().then(bans=> {
12 if(bans.size == 0) return
13 let bUser = bans.find(b => b.user.id == userID)
14 if(!bUser) return
15 msg.guild.members.unban(bUser.user)
16})
17
18 ;}
1client.on('message', (message) => {
2 if (message.content == '/muteAll') {
3 let channel = message.member.voiceChannel;
4 for (let member of channel.members) {
5 member[1].setMute(true)
6 }
7 }
8});
9
1const Discord = require('discord.js')
2
3exports.run = async (client, message, args) => {
4 if (!message.member.hasPermission('MUTE_MEMBERS')) return message.reply('You cannot use this command');
5 if (!message.guild.me.hasPermission('MANAGE_ROLES')) return message.reply('I cannot use this command as i dont have the \`MANAGE_ROLES\` Permission on my role');
6
7 //Variables
8 var muteRole = message.guild.roles.find(r => r.name === 'YOUR_MUTE_ROLE_NAME');
9 var memberRole = message.guild.roles.find(r => r.name === 'YOUR_MAIN_MEMBER_ROLE');
10
11 //let
12 let member = message.mentions.members.first();
13 let reason = args.slice(1).join(' ');
14 if (!reason) reason = 'No Reason Given';
15
16 message.member.roles.add(muteRole);
17 message.member.roles.remove(memberRole);
18
19 var muteEmbed = new Discord.MessageEmbed()
20 .setColor('RED')
21 .setTitle('${member} has been muted for ${reason}');
22
23 message.channel.send(muteEmbed).catch(err => console.log(err));
24}
1const Discord = require('discord.js');
2const client = new Discord.Client();
3const prefix = "!";
4const token = ""; // Fill in your token
5
6client.on("message", msg => {
7 msg.content.startsWith(prefix + "mute") {
8
9
10 // Variables
11 var muteRole = msg.guild.roles.find(role => role.name.toLowerCase().includes("muted"));
12 var muteChannel = msg.guild.channels.find(channel => channel.name.includes("modlogs"));
13 var muteUser = msg.mentions.members.first();
14 var muteReason = msg.content.slice(prefix.length + 27);
15
16
17 // Conditions
18 if (!msg.member.hasPermission("MANAGE_MESSAGES")) return msg.channel.send("You don't have the permissions");
19 if (!muteUser) return msg.channel.send("You have to mention a valid member");
20 if (!muteChannel) return msg.channel.send("There's no channel called modlogs");
21 if (!muteRole) return msg.channel.send("There's no role called muted");
22 if (!msg.guild.member(client.user.id).hasPermission("MANAGE_ROLES")) return msg.channel.send("I Don't have permissions");
23 if (!muteReason) muteReason = "No reason given";
24
25 // Embed
26 var muteEmbed = new Discord.RichEmbed()
27 .setTitle("Mute")
28 .addField("Muted user", muteUser)
29 .addField("Reason", muteReason)
30 .setFooter(`Muted by ${msg.author.tag}`)
31 .setTimestamp();
32
33 //Mute
34 muteUser.addRole(muteRole);
35 msg.channel.send(`${muteUser} has been muted`);
36 muteChannel.send(muteEmbed);
37
38 }
39})
1
2client.on('message', message => {
3 if (message.content.startsWith(prefix + 'unmute')) {
4 if (message.member.hasPermission('MANAGE_ROLES')) {
5 const role = message.guild.roles.cache.find(role => role.name === 'Muted');
6 const member = message.mentions.members.first();
7 member.roles.remove(role);
8 message.channel.send(member + ' Has Been Unmuted');
9
10 } else {
11 message.channel.send("Please Mention Who To Unute")
12 }
13 }
14})
1client.on("message", message => {
2 if (message.content.startsWith(prefix + "mute")) {
3
4
5 // Variables
6 var muteRole = message.guild.roles.find(role => role.name.toLowerCase().includes("muted"));
7 var muteChannel = message.guild.channels.find(channel => channel.name.includes("modlogs"));
8 var muteUser = message.mentions.members.first();
9 var muteReason = message.content.slice(prefix.length + 27);
10
11
12 // Conditions for muting
13 if (!message.member.hasPermission("MANAGE_MESSAGES")) return message.channel.send("You don't have the permissions"); //the member has higher perms
14 if (!muteUser) return message.channel.send("You have to mention a valid member");
15 if (!muteChannel) return message.channel.send("There's no channel called modlogs");
16 if (!muteRole) return message.channel.send("There's no role called muted");
17 if (!message.guild.member(client.user.id).hasPermission("MANAGE_ROLES")) return message.channel.send("I Don't have permissions");
18 if (!muteReason) muteReason = "No reason given";
19
20 // Embed for details of mute
21 var muteEmbed = new Discord.RichEmbed()
22 .setTitle("Mute")
23 .addField("Muted user", muteUser)
24 .addField("Reason", muteReason)
25 .setFooter(`Muted by ${message.author.tag}`)
26 .setTimestamp();
27
28 //Mute
29 muteUser.addRole(muteRole);
30 message.channel.send(`${muteUser} has been muted`);
31 muteChannel.send(muteEmbed);
32
33 }
34})