Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

186
Views
TypeError: no se pueden leer las propiedades de la interacción del comando discord.js V13 indefinido (leyendo 'caché')

Recibo este error cuando el comando ejecutó el comando es un comando para activar el silencio y mi controlador es un comando de barra oblicua

cuando configuro el miembro como tipo de miembro en las opciones, funciona bien, pero lo quiero con ID si alguien tiene una solución y gracias

 if(target.roles.cache.has(muterole)) { ^ TypeError: Cannot read properties of undefined (reading 'cache')

este el comando:

 const { MessageEmbed, CommandInteraction } = require("discord.js"); module.exports = { name: "unmute", description: "Unmute a Member", permission: "MANAGE_MESSAGES", options: [ { name: "member", description: "Member ID", required: true, type: "STRING" }, { name: "reason", description: "provide unmute reason", required: true, type: "STRING" } ], /** * * @param {CommandInteraction} interaction */ async execute(interaction) { const { guild, channel, member, options } = interaction; const target = options.getString("member"); const reason = options.getString("reason"); const logchannel = guild.channels.cache.get("877754209016086588"); const muterole = guild.roles.cache.get("944200095040167946"); console.log(target); const logembed = new MessageEmbed() .setColor("AQUA") .setAuthor({ name: `${member.user.tag}`, iconURL: `${member.user.avatarURL({ dynamic: true, size: 512 })}` }) .setDescription(` ${target} got unmuted by : ${member} reason : ${reason} `) .setTimestamp(); const response = new MessageEmbed() .setDescription(` ${target} unmuted `); if(target.roles.cache.has(muterole)) { await target.roles.remove(muterole); await interaction.reply({embeds: [response], ephemeral: true}); await logchannel.send({ content: `${member}`, embeds: [logembed] }); } else { await interaction.reply({content: `${target} is not muted`, ephemeral: true}); } } }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

  • El tipo de USER admite ID de Snowflake , menciones de usuarios y menciones de miembros .
  • Puede agregar el type: "USER" y usar
 const member = interaction.options.getMember("target"); // for a GuildMember const user = interaction.options.getUser("target"); // for a User
  • Una vez más, admite ID de usuario y menciones.
  • El uso de una cadena para obtener un miembro/usuario no es eficiente porque si la ID proporcionada no es válida, el bot devuelve null y puede provocar un bloqueo.
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!