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

263
Views
How do I delete an interaction reply in discord.js v13?

I'm trying to delete the bot's reply to the user's purge command.

module.exports = {
    data: new SlashCommandBuilder()
        .setName("purge") // Command name
        .setDescription("Deletes a set number of messages") // Command description
        .addNumberOption((option) => // Adds an argument
            option 
                .setName("number") // Argument name
                .setDescription("Sets the number of messages to delete") // Argument description
                .setRequired(true), // Argument requirement
        ),
    async execute(interaction) {
        if (interaction.member.permissions.has("MANAGE_MESSAGES") && interaction.guild.me.permissions.has("MANAGE_MESSAGES")) {
            await interaction.channel.bulkDelete(interaction.options.getNumber("number"));
            await interaction.reply(`Deleted ${interaction.options.getNumber("number")} message(s) successfully.`);
            setTimeout(() => interaction.message.delete(), 1000);
        } else if (interaction.member.permissions.has("MANAGE_MESSAGES") === false) {
            interaction.reply("You do not have the **Manage Messages** permission. Please ask a moderator to give you this permission.")
        } else {
            interaction.reply("I have not been given the relevant permissions to do this. Please contact a moderator and ask them to give me the **Manage Messages** permission.")
        }
    }
}

All the solutions I have tried all throw a " is not a function" or "Cannot read the property of undefined". Could anyone help with this? Thanks!

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Use <Interaction>.deleteReply()

about 4 years ago · Juan Pablo Isaza Report

0

Use method .deleteReply():

async execute(interaction) {
  const replyMessage = await interaction.reply('message');
  setTimeout(() => interaction.deleteReply(), 10000);
}
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!