WeebDev / Commando

[DEPRECATED] ⚫ Commando Discord bot built on discord.js-commando.
https://github.com/Gawdl3y/discord.js-commando
MIT License
77 stars 63 forks source link

Music - play command - Cannot read property 'id' of undefined #76

Closed Darkcl0w closed 7 years ago

Darkcl0w commented 7 years ago

Hey, First of all, thanks for that code, it's great :)

I'm trying to put the music part in my commando bot. I took the commands/music folder and the structure/Song.js. I also downloaded all node.js packages it required.

I can start the bot without a problem, the error occure when I launch the play command with an url (or with any word). Here is the console error : error: TypeError: Cannot read property 'id' of undefined at PlaySongCommand.run (C:\Users\***\botDiscord\Wall-E\commands\music\play.js:89:62) at <anonymous> at process._tickCallback (internal/process/next_tick.js:169:7)

And the message of the bot : @Darkcl0w, couldn't obtain the search result video's details.

I followed the stack trace and the error and it leads me to that line in the play.js const video2 = await this.youtube.getVideoByID(videos[0].id);

That means, even if I use a url it cant reach the video because it should gets it juste before, with these lines : const video = await this.youtube.getVideo(url); return this.handleVideo(video, queue, voiceChannel, msg, statusMsg);

I'm sure there is something I don't understund but I don't know what...

Of course if you need other informations I'll send them to you.

Have a nice day/night,

Darkcl0w

iCrawl commented 7 years ago

I'll have a look.

Darkcl0w commented 7 years ago

Ok, thanks ;)

if you want to see all the bot, you can see it there.

p4rkrs commented 7 years ago

I got that error when I add playlist personally. But the music are added and played

iCrawl commented 7 years ago

@Darkcl0w Did you provide all the required things as a process.env? I see you basically just copied everything over. That means you need to provide a youtube api key etc.

p4rkrs commented 7 years ago

@iCrawl The process.env is not the problem. I did it, and got the error too.

Darkcl0w commented 7 years ago

@iCrawl Yeah that is certainly a part of the problem. I didn't know anything about process.env. I have a youtube key api but I don't know where I have to put it :/

If you don't have the time to explain (what I perfectly understand), could you redirect me to a good tutorial ?

Thanks for your answer ;)