{"size": 646, "ext": "js", "max_stars_repo_path": "commands/removeRole.js", "max_stars_repo_name": "rpsychologist/meehlbot-discord", "max_stars_repo_stars_event_min_datetime": "2021-03-08T17:34:48.000Z", "max_stars_repo_stars_event_max_datetime": "2021-03-08T17:34:48.000Z", "max_issues_repo_path": "commands/removeRole.js", "max_issues_repo_name": "rpsychologist/meehlbot-discord", "max_issues_repo_issues_event_min_datetime": "2020-09-10T17:59:44.000Z", "max_issues_repo_issues_event_max_datetime": "2020-09-10T17:59:44.000Z", "max_forks_repo_path": "commands/removeRole.js", "max_forks_repo_name": "rpsychologist/meehlbot-discord", "max_forks_repo_forks_event_min_datetime": "2021-03-08T17:34:51.000Z", "max_forks_repo_forks_event_max_datetime": "2021-03-08T17:34:51.000Z"}
{"max_stars_count": 1, "max_issues_count": 1, "max_forks_count": 1, "avg_line_length": 29.3636363636, "max_line_length": 69, "alphanum_fraction": 0.6114551084}
const config = require("../config.json");
const { roles } = config;

module.exports = {
  name: "remove",
  description: "Remove a self-assigned role",
  usage: "<role>",
  guildOnly: true,
  args: true,
  execute(message, args) {
    const arg = args.join(" ");
    const roleString = roles.find((r) => r === arg);
    if (typeof roleString === "undefined") {
      return message.reply(`'${arg}' is not a valid role`);
    }
    let guild = message.member.guild;
    const role = guild.roles.cache.find((r) => r.name === arg);
    message.member.roles.remove(role);
    message.reply(`the '${roleString}' role should be removed now.`);
  },
};
