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

216
Views
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 answers
Answer question

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 Report

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 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!