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

414
Views
Discord.js bot crashed after trying to send command

I'm coding a bot discord. I'm trying to make a "Slash Command" however I can't understand why when I ask it to return an embed it doesn't work and returns this error

D:\BotDiscord\ღø\node_modules\discord.js\src\rest\RequestHandler.js:298
      throw new DiscordAPIError(data, res.status, request);
            ^

DiscordAPIError: Unknown Webhook
    at RequestHandler.execute (D:\BotDiscord\ღø\node_modules\discord.js\src\rest\RequestHandler.js:298:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (D:\BotDiscord\ღø\node_modules\discord.js\src\rest\RequestHandler.js:50:14)
    at async InteractionWebhook.fetchMessage (D:\BotDiscord\ღø\node_modules\discord.js\src\structures\Webhook.js:283:18)
    at async D:\BotDiscord\ღø\commands\ping.js:22:29 {
  method: 'get',
  path: '/webhooks/898270130478407730/aW50ZXJhY3Rpb246ODk5MzUyMjc5NTM3MzE5OTM3Om5ZOFhFMjZPQ2N6dFU5YzhkZ0xpTUtkQ1IxRHl3WlFFa0szNHZmdG5rNllPTTRwRTltV0Q1VFJOUDJhc0VMV1RmdVhVTU1oNURGODRqNjc5aW5UMjVCTTVKdVUzMGc0VG9ZbjJJSWhtV2czbkFpZmsyVVp5U1VrdjlkS0pGZTdL/messages/@original',
  code: 10015,
  httpStatus: 404,
  requestData: { json: undefined, files: [] }
}

My current code looks like this :

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

const moment = require("moment");
const request = require("superagent");

module.exports = {
    data: new SlashCommandBuilder()
        .setName(`ping`)
        .setDescription(`Calcul du temps d'envoit d'un message.`),
        /**
         * 
         * @param {CommandInteraction} interaction 
         */
    async execute(interaction) {

        var FirstQuery = new Date;
        request(`http://www.google.com`, async function (error, response, body) {
            var LastQuery = new Date;
            var Time = LastQuery.getTime() - FirstQuery.getTime();
            var Response = Time/(5*2);

            const embed = new MessageEmbed()
                .setColor(0x234259)
                .setDescription(`🏓 **Le temps de réponse est de ${Response}ms.**`)
            await interaction.reply({ embeds: [embed] });
        })
        
    }
}

Thanks in advance for the help

about 4 years ago · Juan Pablo Isaza
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!