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

149
Views
Bot is removing all songs from queue instead of 1 when song stops

I'm trying to make a queue and make my bot play it until bot has no songs in queue but istead of removing 1 song from queue (song that was played) - queue clears fully! Code:

  player.on(AudioPlayerStatus.Idle, () => {
    queue.splice(0, 1);
    if(!queue[0]) return;
    resource = createAudioResource(join('./music/', `${queue[0].toLowerCase()}.mp3`));
    player.play(resource);
  });

I tried console logging every step (except if(!queue[0]) return) and got this:

song1,song2,song3
song2,song3
song2,song3
song2,song3
song3
song3
song3
<empty>

What am I doing wrong?

Update 1: It removes all the songs one by one, start playing last song I added and right after it - removes last song from array

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!