1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-11-14 22:10:18 +00:00
musix-oss/src/commands/lyrics.js
2020-04-20 19:56:23 +03:00

34 lines
1.0 KiB
JavaScript

const { getLyrics } = require("genius-lyrics-api");
module.exports = {
name: "lyrics",
alias: "l",
usage: "<song>",
description: "see the lyrics for a song",
onlyDev: false,
permission: "none",
category: "util",
async execute(msg, args, client, Discord, prefix, command) {
const searchString = args.slice(1).join(" ");
const options = {
apiKey: client.config.genius_api_key,
title: searchString,
artist: "",
optimizeQuery: true,
};
const queue = client.queue.get(msg.guild.id);
if (queue && !args[1]) options.title = queue.songs[0].title;
if (!queue && !args[1])
return msg.channel.send(client.messages.lyricsUsage);
getLyrics(options).then((lyrics) => {
if (lyrics === null)
return msg.channel.send(client.messages.noResultsLyrics);
const embed = new Discord.MessageEmbed()
.setTitle(client.messages.lyricsTitle)
.setDescription(lyrics)
.setColor(client.config.embedColor);
msg.channel.send(embed);
});
},
};