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

353
Views
Discord JS - DiscordAPIError: Unknown Message

I get an error:

DiscordAPIError: Unknown Message
    at RequestHandler.execute (D:\Programming\Discord Bot\node_modules\discord.js\src\rest\RequestHandler.js:298:13)        
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (D:\Programming\Discord Bot\node_modules\discord.js\src\rest\RequestHandler.js:50:14)      
    at async MessageManager.delete (D:\Programming\Discord Bot\node_modules\discord.js\src\managers\MessageManager.js:205:5)
    at async Message.delete (D:\Programming\Discord Bot\node_modules\discord.js\src\structures\Message.js:741:5)
    at async AudioPlayer.<anonymous> (D:\Programming\Discord Bot\src\commands\next.js:44:21) {
  method: 'delete',
  path: '/channels/888095042437259287/messages/909879363472855080',
  code: 10008,
  httpStatus: 404,
  requestData: { json: undefined, files: [] }
}

when trying to delete prev. message like this:

await client.message.channel.send({
            content: `Song "${client.currentSong}" is playing`,
            components: [row],
        })
            .then(message => {
                client.player.on(AudioPlayerStatus.Idle, async () => {
                    await message.delete();
                });
            });

This code is executing via one more event code:

client.player.on(AudioPlayerStatus.Idle, () => {
    if (!client.loop) client.playlist.shift();
    if (client.playlist.length === 0) return;
    next.run(client.message, client.args, client);
});

Why does it not work?

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

0

You are making an infinite event listener, meaning whenever the audio player goes idle, it will try to delete the message (even if it already got deleted). Change it client.player.once so the listener gets deleted on the first time.

.then(message => {
    client.player.once(AudioPlayerStatus.Idle, async () => {
        await message.delete();
    });
})
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!