DisTubeError [CANNOT_RESOLVE_SONG]: Bot can't skip/play next song #273
Answered
by
RedEagle-dh
RedEagle-dh
asked this question in
Q&A
-
I receive an error when I want to skip the current song. I previously added a song to the queue and when I print the queue, the song is there. But when I want to skip, I receive the following error: E:\JavaScript\privatebot\node_modules\distube\dist\index.js:1330
throw new DisTubeError("CANNOT_RESOLVE_SONG", song);
^
DisTubeError [CANNOT_RESOLVE_SONG]: Cannot resolve undefined to a Song
at DisTubeHandler.resolve (E:\JavaScript\privatebot\node_modules\distube\dist\index.js:1330:11)
at DisTube.play (E:\JavaScript\privatebot\node_modules\distube\dist\index.js:2244:33)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
errorCode: 'CANNOT_RESOLVE_SONG'
} Thats my add to queue function: [...]
const song = event.options.getString("songname");
const voice = event.member.voice.channel;
if (!voice) {
event.reply({content: "You have to be in a voice to do this!", ephemeral: true})
} else {
const result = event.client.DisTube.search(song, {limit: 5, type: "video"});
result.then(res => {
const s = new Song(res[0], {source: "youtube"}); // Creating a Song object for the queue
console.log(res[0]);
// "addToQueue()" is NOT in the documentation of DisTube... But it works??
const q = event.client.DisTube.getQueue(event.guild).addToQueue(s, 1);
})
[...]```
Thats my skip function:
```js
[...]
await event.client.DisTube.skip(event.guild).then((song) => {
console.log(song.name)
});
[...] I really don't know what to do :/ |
Beta Was this translation helpful? Give feedback.
Answered by
RedEagle-dh
Aug 25, 2022
Replies: 1 comment 3 replies
-
I found the issue, it was the event "finishSong", there was code that said the bot should play something out of a .json file, but there wasn't another song. So the queue works, but I don't understand why there is no |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
RedEagle-dh
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I found the issue, it was the event "finishSong", there was code that said the bot should play something out of a .json file, but there wasn't another song. So the queue works, but I don't understand why there is no
addToQueue()
in the docs... Please add this!