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

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

0

Use <Interaction>.deleteReply()

about 4 years ago · Juan Pablo Isaza Relatório

0

Use method .deleteReply():

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