Added lyrics command
This commit is contained in:
12
index.js
12
index.js
@@ -13,9 +13,15 @@ client.on('message', message => {
|
|||||||
const args = message.content.slice(config.prefix.length).trim().split(" ");
|
const args = message.content.slice(config.prefix.length).trim().split(" ");
|
||||||
const command = args.shift().toLowerCase();
|
const command = args.shift().toLowerCase();
|
||||||
|
|
||||||
if (command === "add") {
|
if (command === "lyrics") {
|
||||||
Genius.search_song(args.join(" "), (song) => {
|
Genius.search_song(args.join(" "), song => {
|
||||||
message.channel.send("Found " + song.result.full_title + ".");
|
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) + "```");
|
||||||
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user