Advertisement
UndercoverNL

unmute.js

May 21st, 2020
1,303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require("discord.js");
  2.  
  3. module.exports.run = async (client, message, args) => {
  4.  
  5.     if (!message.member.hasPermissions ('KICK_MEMBERS')) return message.channel.send("You do not have permission for this command!");
  6.     const mod = message.author;
  7.     let user = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
  8.     if (!user) return message.channel.send("Specify a valid user!")
  9.     if (!user.roles.find(`name`, "Muted")) return message.channel.send('this person is not muted!')
  10.     let muterole = message.guild.roles.find(`name`, "Muted");
  11.     if (!muterole) message.channel.send("Could not find the `Muted` role!")
  12.  
  13.     await (user.removeRole(muterole.id));
  14.            
  15.     let muteEmbed2 = new Discord.RichEmbed()
  16.     .setTitle(`You are unmuted on **${message.guild}**!`)
  17.     .setColor("#00ff00")
  18.     .setThumbnail(client.user.displayAvatarURL)
  19.     .addField("Unmuted by:", message.author)
  20.     user.send(muteEmbed2);
  21.  
  22.     return message.channel.send(`${user} is successfully unmuted!`)
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement