Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(command === 'mute') {
- if(message.member.hasPermissions('MUTE_MEMBERS')) {
- let person = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[1]))
- if (!person) return message.reply('You must state the user you would like to mute!');
- let mainrole = message.guild.roles.find(role => role.name === 'Verified');
- let muterole = message.guild.roles.find(role => role.name === 'Muted');
- let time = args[1];
- if (!mainrole) {
- message.guild.defaultRole.setPermissions(0)
- }
- if (!muterole) {
- message.channel.send('This server does not have a mute role, I am now creating one.')
- console.log('Creating mute role.');
- message.guild.createRole({
- name: 'Muted',
- color: 'GREY',
- permissions: ['VIEW_CHANNEL', 'READ_MESSAGES', 'READ_MESSAGE_HISTORY']
- }).then(role => console.log('Muted role created.')).catch(console.error);
- message.channel.send('The muted role has been created!\n Retype the command to mute the user!')
- }else
- if (!time) {
- return message.reply('You must state a time you would like to mute the user for!')
- }
- person.removeRole(mainrole.id);
- person.addRole(muterole.id);
- message.channel.send(`@${person.user.username} has been muted for ${ms(ms(time))}!`);
- setTimeout(function () {
- person.addRole(mainrole.id);
- person.removeRole(muterole.id);
- message.channel.send(`@${person.user.username} has been unmuted!`)
- }, ms(time));
- }else {
- message.reply('You cannot use that command!')
- }
Advertisement
Add Comment
Please, Sign In to add comment