zyrouge / node-genius-lyrics

Simple lyrics fetcher that uses Genius. Also has official API implementations.
https://genius-lyrics.js.org
MIT License
61 stars 12 forks source link

tracklyrics.lyrics() is not a function #29

Closed yu4L closed 2 years ago

yu4L commented 2 years ago

I am following the example in the README, although while using it in my code, my console says that tracklyrics.lyrics is not a function. I am trying to make a command in Discord.js with it so whenever my bot plays a song, the users can get the lyrics of the current song that is playing.

This is how I am using the package:


const queue = await client.distube.getQueue(interaction.guildId);
const tracklyrics = queue.songs[0];
const lyrics = await tracklyrics.lyrics();

//Everything down below shouldn't be relevant to the error. 

//response.setAuthor({ name: "LYRICS", iconURL: user.avatarURL({ dynamic: true }) })
//response.setDescription("**_ Sent Lyrics to your DMs_**")
//user.send({ embeds: [new MessageEmbed().setColor("#2F3136").setAuthor({ name: "LYRICS", iconURL: //user.avatarURL({ dynamic: true }) }).setDescription(`${lyrics}`)] });
//return interaction.reply({ embeds: [response] });
zyrouge commented 2 years ago

May I know what queue.songs is? If it isn't an instance of Song from genius-lyrics package, it's not going to work. Edit: Checked distube's docs and it isn't.

Solution: Get the title -> Use it to search -> Get the lyrics.

zyrouge commented 2 years ago

This issue isn't something wrong with the package. Please read the full example to know how it actually works. Closing this.

yu4L commented 2 years ago

This is what I did now, which is still throwing the same error:

const track = queue.songs[0];
const tracklyrics = track.name;
const lyrics = await tracklyrics.lyrics();