Guest User

tempmute.js

a guest
Jan 20th, 2019
64
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // If the command is like: -tempMute <mention> <minutes> [reason]
  2. exports.run = (client, message, [mention, minutes, ...reason]) => {
  3. // You need to parse those arguments, I'll leave that to you
  4.  
  5. // This is the role you want to assign to the user
  6. let mutedRole = message.guild.roles.find(role => role.name == "Muted");
  7. // This is the member you want to mute
  8. let member = message.mentions.members.first();
  9.  
  10. // Mute the user
  11. member.addRole(mutedRole, `Muted by ${message.author.tag} for ${minutes} minutes. Reason: ${reason}`);
  12.  
  13. // Unmute them after x minutes
  14. setTimeout(() => {
  15. member.removeRole(mutedRole, `Temporary mute expired.`);
  16. }, minutes * 60000);
  17. };
RAW Paste Data