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

252
Views
Command is working, but also getting 'interaction failed' at the same time?

Title might be a little confusing so here's a screenshot of what's happening when I type a command:

enter image description here

It works, but then it fails at the same time. I get no errors from this interaction. Here's my code:

const { SlashCommandBuilder } = require("@discordjs/builders");
const { MessageEmbed } = require("discord.js");

module.exports = {
  data: new SlashCommandBuilder()
    .setName("suggest")
    .setDescription("Send your suggestion to the specified channel")
    .addStringOption((option) =>
      option
        .setName("suggestion")
        .setDescription("Your suggestion")
        .setRequired(true)
    ),
  async execute(interaction) {
    let suggestion = interaction.options.getString("suggestion");
    const embed = new MessageEmbed()
      .setColor("#0099ff")
      .setTitle(`New suggestion by ${interaction.member.displayName}`)
      .setDescription(`${suggestion}`);
    await interaction.channel
      .send({
        embeds: [embed],
      })
      .then(function (interaction) {
        interaction.react(`๐Ÿ‘`).then(interaction.react(`๐Ÿ‘Ž`));
      });
  },
};

about 4 years ago ยท Juan Pablo Isaza
1 answers
Answer question

0

Try deferring the reply. More info on it here

For example,

const wait = require('util').promisify(setTimeout);

client.on('interactionCreate', async interaction => {
    if (!interaction.isCommand()) return;

    if (interaction.commandName === 'ping') {
        await interaction.deferReply();
        await wait(4000);
        await interaction.editReply('Pong!');
    }
});
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!