Added lyrics command

This commit is contained in:
2020-12-17 23:23:40 +01:00
parent 4e08c70bcb
commit 0bb788f27d

View File

@@ -13,9 +13,15 @@ client.on('message', message => {
const args = message.content.slice(config.prefix.length).trim().split(" ");
const command = args.shift().toLowerCase();
if (command === "add") {
Genius.search_song(args.join(" "), (song) => {
message.channel.send("Found " + song.result.full_title + ".");
if (command === "lyrics") {
Genius.search_song(args.join(" "), song => {
Genius.get_lyrics(song.id, (err, lyrics) => {
if (err) {
console.log("Error while fetching lyrics: " + err.message);
message.channel.send("Error fetching lyrics, please retry in a few seconds");
}
else message.channel.send("```" + lyrics.slice(9, 1900) + "```");
});
})
}
})