Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

208
Vistas
TypeError: Cannot read properties of undefined (reading 'editReply')

I'm making a bot with Discord.js and this is my code:

const { CommandInteraction, Interaction } = require("discord.js");

module.exports = {
name: "test",
description: "Tests the bot.",
ephemeral: "false",
permission: "SEND_MESSAGES",
/**
 * 
 * @param {CommandInteraction} interaction 
 */
execute(interaction) {
    interaction.reply({content: "Testing..."})
    .then(interaction => {
        setTimeout(function(){
            interaction.editReply("Test Successful ✔")
        }, 3000)
    })
}

}

But I get an error in the terminal when I try to start the bot. This is the error I get:

C:\Users\Manuel\Desktop\Manuel\Programs\Programming\Visual Studio Code\Helix32 (Discord)\Commands\Developer\test.js:16
            interaction.editReply("Test Successful ✔")
                        ^

TypeError: Cannot read properties of undefined (reading 'editReply')
at Timeout._onTimeout (C:\Users\Manuel\Desktop\Manuel\Programs\Programming\Visual Studio Code\Helix32 (Discord)\Commands\Developer\test.js:16:29)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7)

Node.js v17.2.0
[nodemon] app crashed - waiting for file changes before starting...
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You need to set the fetchReply to true to return the message, but there really is no need... just use the original interaction

interaction.reply({content: "Testing..."})
    .then(() => { //no "interaction" declaration
        setTimeout(function(){
            interaction.editReply("Test Successful ✔") //use original interaction object
        }, 3000)
    })
about 4 years ago · Juan Pablo Isaza Denunciar

0

I think you are seeing this because you're not getting the interaction back, from the prior call. If you use this (including the flag), it should help:

interaction.reply({ content: 'Pong!', fetchReply: true })

cheers!

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda