mirror of
https://github.com/musix-org/musix-oss
synced 2025-07-07 10:40:49 +00:00
to js
This commit is contained in:
33
src/commands/lyrics.js
Normal file
33
src/commands/lyrics.js
Normal file
@ -0,0 +1,33 @@
|
||||
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);
|
||||
});
|
||||
},
|
||||
};
|
Reference in New Issue
Block a user