Search code examples
discord.jsdistube

Distube remove command


I want to make a command so that it removes a song from the queue. I am using discord.js v13 and distube. I get this error TypeError: queue.splice is not a function And here is the code for the commad:

else if (cmd == "remove" || cmd == "del"){
  queue = distube.getQueue
  const index = parseInt(args[0]) - 1
  queue.splice(index , 1)
  message.channel.send(`Removed track number ${index}`)
}

Solution

  • you are not accessing the song list, use queue.songs to access it

    https://distube.js.org/#/docs/DisTube/stable/class/Queue?scrollTo=songs