Advertisement
Guest User

tempmute.js

a guest
Jan 20th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  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. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement