text: /* eslint-disable no-unused-vars */
  const { Message, MessageEmbed, Permissions } = require("discord.js");
  const ms = require("ms");
  
  module.exports = {
    name: "mute",
    /**
     * @param {Message} message
     */
    run: async (client, message, args) => {
      try {
        if (!message.member.permissions.has(Permissions.FLAGS.MANAGE_GUILD)) return;
        const Member =
          message.mentions.members.first() ||
          message.guild.members.cache.get(args[0]);
        if (!Member) return message.channel.send({content:"Member is not found."});
        const role = message.guild.roles.cache.find(
          (role) => role.name.toLowerCase() === "muted"
        );
        if (!role) {
          try {
            message.channel.send({content:
              "Muted role is not found, attempting to create muted role."
            }
            );
  
            let muterole = await message.guild.roles.create({
              data: {
                name: "muted",
                permissions: [],
              },
            });
            message.guild.channels.cache
              .filter((c) => c.type === "text")
              .forEach(async (channel, id) => {
                await channel.permissionOverwrites.edit(muterole, {
                  SEND_MESSAGES: false,
                  ADD_REACTIONS: false,
                });
              });
            message.channel.send({content: "Muted role has sucessfully been created."});
          } catch (error) {
            console.log(error);
          }
        }
        let role2 = message.guild.roles.cache.find(
          (r) => r.name.toLowerCase() === "muted"
        );
        if (Member.roles.cache.has(role2.id))
          return message.channel.send({content:
            `${Member.displayName} has already been muted.`
          }
          );
        await Member.roles.add(role2);
        message.channel.send({content:`${Member.displayName} is now muted.`});
      } catch (e) {
        return message.channel.send({content:
          `An error has occured, please try again. If this keeps happening please dm HypsterOP#5687 his dms are always open`
        }
        );
      }
    },
  };
  