Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

210
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda