Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Unmute/Mute Commands
- // Mute Command
- if (msg.startsWith(prefix + 'MUTE')) {
- // Check if the user has the `Admin` role.
- if (!message.member.roles.find("name", "Moderator")) { // This checks to see if they DONT have it, the "!" inverts the true/false
- message.channel.send('You Need The \`Moderator or Admin\` Role To Use This Command !'); // Tells the user in chat that they need the role.
- return; // This returns the code, so the rest doesn't run.
- }
- let reason = args.slice(1).join(' ');
- let user = message.mentions.users.first();
- let modlog = bot.channels.find('name', 'mod-log');
- let muteRole = bot.guilds.get(message.guild.id).roles.find('name', 'Muted');
- if (!modlog) return message.reply('I Cannot Find a mod-log Channel !').catch(console.error);
- if (!muteRole) return message.reply('I Cannot Find a Mute Role !').catch(console.error);
- if (reason.length < 1) return message.reply('You Must Supply a Reason For The Mute.').catch(console.error);
- if (message.mentions.users.size < 1) return message.reply('You Must Mention Someone To Mute Them.').catch(console.error);
- const embed = new Discord.RichEmbed()
- .setColor(0xCB4335)
- .setTimestamp()
- .addField('Action:', 'Mute')
- .addField('User:', `${user.username}#${user.discriminator} (UserID: ${user.id})`)
- .addField('Modrator:', `${message.author.username}#${message.author.discriminator}`)
- .addField('Reason', reason);
- if (!message.guild.member(bot.user).hasPermission('MANAGE_ROLES_OR_PERMISSIONS')) return message.reply('I Do Not Have The Correct Permissions.').catch(console.error);
- if (message.guild.member(user).roles.has(muteRole.id)) {
- message.guild.member(user).removeRole(muteRole).then(() => {
- bot.channels.get(modlog.id).sendEmbed(embed).catch(console.error);
- });
- } else {
- message.guild.member(user).addRole(muteRole).then(() => {
- bot.channels.get(modlog.id).sendEmbed(embed).catch(console.error);
- });
- }
- }
- // UnMute Command
- if (msg.startsWith(prefix + 'UNMUTE')) {
- // Check if the user has the `Admin` role.
- if (!message.member.roles.find("name", "Moderator")) { // This checks to see if they DONT have it, the "!" inverts the true/false
- message.channel.send('You Need The \`Moderator or Admin\` Role To Use This Command !'); // Tells the user in chat that they need the role.
- return; // This returns the code, so the rest doesn't run.
- }
- let user = message.mentions.users.first();
- let modlog = bot.channels.find('name', 'mod-log');
- let muteRole = bot.guilds.get(message.guild.id).roles.find('name', 'Muted');
- if (!modlog) return message.reply('I Cannot Find a mod-log Channel !').catch(console.error);
- if (!muteRole) return message.reply('I Cannot Find a Mute Role !').catch(console.error);
- if (message.mentions.users.size < 1) return message.reply('You Must Mention Someone To Mute Them.').catch(console.error);
- const embed = new Discord.RichEmbed()
- .setColor(0x35CB35)
- .setTimestamp()
- .addField('Action:', 'Unmute')
- .addField('User:', `${user.username}#${user.discriminator} (UserID: ${user.id})`)
- .addField('Modrator:', `${message.author.username}#${message.author.discriminator}`)
- .addField('Reason', 'Mute Expired.');
- if (!message.guild.member(bot.user).hasPermission('MANAGE_ROLES_OR_PERMISSIONS')) return message.reply('I Do Not Have The Correct Permissions.').catch(console.error);
- if (message.guild.member(user).roles.has(muteRole.id)) {
- message.guild.member(user).removeRole(muteRole).then(() => {
- bot.channels.get(modlog.id).sendEmbed(embed).catch(console.error);
- });
- } else {
- message.guild.member(user).addRole(muteRole).then(() => {
- bot.channels.get(modlog.id).sendEmbed(embed).catch(console.error);
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement