const unbanUserId = interaction.options.getString('user_id') try { const getGuildBanList = await interaction.guild.bans.fetch() const checkTheUserStated = getGuildBanList.get(unbanUserId).user if (checkTheUserStated) { await interaction.guild.members.unban(unbanUserId) const unBannedEmbed = new MessageEmbed() .setColor('PURPLE') .setTitle('User unbanned') .setDescription(`Successfully unbanned <@!${unbanUserId}>`) return interaction.editReply({ embeds: [unBannedEmbed] }) } else { const notBanned = new MessageEmbed() .setColor('PURPLE') .setDescription(`The stated user is not banned.`) return interaction.editReply({ embeds: [notBanned] }) } } catch(e) { console.log(e) } Estoy tratando de hacer que cuando el usuario no esté prohibido, devuelva una inserción simple, pero parece que sigue regresando Cannot read properties of undefined (reading 'user')
¿Puedes intentar usar .find() ?
const checkTheUserStated = getGuildBanList.find(user => user.id === unbanUserId.id);console.regístrelo o pruébelo, avíseme si funciona para usted