showing results for - "discord js mute command"
Deandre
13 Aug 2019
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}
Ernesto
30 Feb 2018
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})
Miguel
20 Feb 2019
1client.on('message', message => {
2    if(message.content.startsWith(prefix + 'mute')){
3         if(message.member.hasPermission('MANAGE_ROLES')) {
4             const role = message.guild.roles.cache.find(role => role.name === 'Muted');
5                 const member = message.mentions.members.first();
6                     member.roles.add(role); 
7                     message.channel.send(member + ' Has Been Muted');
8
9            } else {
10                 message.channel.send("Please Mention Who To Mute")
11             }     
12        }
13})
queries leading to this page
mute bot discord jsmute command discord js idmusic bot discord js mute commandmute all members discord jsmute member discord jsdiscord bot mute user jshow to mute a user in discord jsmute npm discord jsmute command for discord jscommande de mute discord jsdiscord js mute someonediscord js mute commandmute discord jsmute command discord jsmute someone discord jshow to mute in a vc discord jshow to mute users discord jsdiscordjs mute commanddiscord js mute selfmute when swear discord jsdiscord js mute commadnmute discord jstemporary mute command discordjsdiscord source code to mute a member from argsserver mute discord jsdiscord js guide mutediscordjs how to make message silenthow to mute members discord js commandmute command and with ms and reason in discord jshow to use mute someone discord jsdiscord js user is muted 3fadd a mute command to bot discord jsmute discord bot jsmute command discord codehow to make mute command discord jshow to make a mute command discordjshow to mute someone in discord jsmute bot discord jdiscord js mute unmute commandmute discord by id discord jsdiscord js how to mute a usermute member discord jsdiscord js voice mutetemp mute command discord jsdiscord js mute in chat codediscord js long mutediscord js mute command code 2020discord js how to mute someonediscord js mute botdiscord js mute systemcreate mute command discord jsdiscordjs timed mutemute member through discord jsmute user discord jsadd mute role discord jsdiscord mute jsdiscord js v12 mute commanddiscord js mutescreate mute role discord jshow to mute someone discord bot jsmute script bot discorddiscord js bot mute itselfdiscord mute members discord jsdiscord js mutemute command with time discord js 12mute member command discord js v12discord js mute role automute command discord jsdiscord js make mute rolediscord js is user mutedmute system discord jsdiscord js user mute updatediscordjs temporary mute commandcomando mute discordhow to make temp mute command discord jsmute command discord js 2020voice mute bot discord js mute 40user discord jsjs discord bot mutemute user discord jstimed mute command discord jsmute someone on discord discord jsdiscord bot javascript mute commandhow to mute someone in discord jsdiscord js mute commmandehow to mute someone in discord 2cjshow to mute members discord jsmute and reasons command discord jsdiscord js 12 mute commanddiscord js guide mute 2funmutemute command discordjscodegreeper discord js mutecodelyon discord js mutemute discord discord jsdiscord js mute a user in voice channelhow to make a mute command in discord jsdiscord js mutediscord js mute codediscord js server mute checkdiscord js mute a usermute command discord js dbjs discord mute bothow to mute after warnings discord jsmute command for discord js botdiscord js mute by iddiscord js mute scriptdiscord js temp mute commandhow to mute someone on discord discord jsmute role discord jsmute command discord 2fjshow to mute a user discord nodejsdiscord js how to show mutes and warns i oncediscord js mute command handdlerdiscord js voice chat server mute memberhow to mute discord jsdiscord js mute command v11mute discord js v12mute and unmute command discord js create mute role if not mademute command with embedded messages discord jsdiscord mute commandhow to make a mute command discord jsdiscord js mute code copydiscord js mute system with timestimed mute with reason command discord js examplemute bot discord jsdiscordjs mute comamndtimed mute with reason command discord jsdiscord js mute command examplemute the bot discord jsmute ms discord jsmute in discord jshow to mute discordmute reason discord jsdiscord mute command codeserver mute command discord jsdiscord js mute command v12discord js server mute memberdiscord js 2c chat mute commandhow to mute a bot discord jsdiscord js mute someone in just one channelmute command discord js without mute role iddiscord mute bot v12discord js how to mute userdiscord js mute memberdiscord js muterolehow to make a mute command in discord js v13mute discords jsmute code discord jsserver mute discord discord jsmute command discord js v12 with databsemute and unmute discord jsdiscord js mute and tempmutediscord js mtempmute and mutemute discord js mshow to mute some discord jstimed mute using ms command discord jshow to mute discord jsmute command discord js v12discord bot with mute commanddiscord js temp mutediscord js mute userhow to mute someone discord jsdiscord js mute commanddiscord js mute membersscript mute discord jsmute person who sent message discord jsmute member discord jsdiscord js mute in chat code copyhow to server mute someone in discord with discord jsdiscord js mute command