#Command not running despite meeting the requirements

1 messages · Page 1 of 1 (latest)

mystic pilot
   .addStringOption((option) =>
      option
        .setName("rank")
        .setDescription("Your respective rank")
        .setRequired(true)
        .addChoices(
          { name: "I", value: "I", roleId: "1051888647961575464" },
          { name: "C", value: "C", roleId: "989618534009159740" },
          { name: "E", value: "E", roleId: "989618534629916732" },
          { name: "RM", value: "RM", roleId: "1069139407204007986" },
          { name: "DD", value: "DD", roleId: "1056906050403573760" },
          { name: "BD", value: "BD", roleId: "899869665780719667" }
        )
    ),

  async execute(interaction) {
    let user = interaction.options.getString("username");
    let link = interaction.options.getString("link");
    let division = interaction.options.getString("division");
    let rank = interaction.options.getString("rank");

    
   const selectedRank = interaction.options.get("rank");
    const selectedRoleId = selectedRank.value.roleId;
    
    if (!interaction.member.roles.cache.has(selectedRoleId)) {
        await interaction.reply("You do not have permission to select that rank!");
        return;
    }

expected to only be able to select the role if you have the roleid tied to the rank - but the message 'You do not have permission to select that rank!' occurs despite having the correct role to select the rank. No errors