Skip to content

Commit

Permalink
[Fix] fixed lyrics command for interactions
Browse files Browse the repository at this point in the history
  • Loading branch information
naseif committed Nov 17, 2021
1 parent 320ed0d commit 6d61d1f
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions commands/Music/lyrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ module.exports = {
apiKey: geniusApiKey,
title: songTitle,
artist: " ",
optimizeQuery: true,
optimizeQuery: false,
};

const lyrics = await getSong(lyricsOptions);
Expand Down Expand Up @@ -83,7 +83,7 @@ module.exports = {
timestamp: new Date(),
};

await message.channel.send({
return await message.channel.send({
embeds: [lyricsEmbed],
});
} catch (error) {
Expand All @@ -109,6 +109,16 @@ module.exports = {
const queue = client.player.getQueue(interaction.guild);
let songTitle;

if (!geniusApiKey)
return await interaction.followUp({
embeds: [
embedMessage(
"#9dcc37",
"You did not add your Genius API token in the config file!"
),
],
});

if (songString) {
songTitle = songString;
} else {
Expand All @@ -133,7 +143,15 @@ module.exports = {
}

try {
const lyrics = await lyricsClient.search(songTitle);
const lyricsOptions = {
apiKey: geniusApiKey,
title: songTitle,
artist: " ",
optimizeQuery: false,
};

const lyrics = await getSong(lyricsOptions);

if (!lyrics)
return await interaction.followUp({
embeds: [
Expand All @@ -146,7 +164,7 @@ module.exports = {

const lyricsEmbed = {
color: "#9dcc37",
title: `${lyrics.artist.name} - ${lyrics.title}`,
title: `${lyrics.title}`,
author: {
name: `${interaction.user.username}`,
icon_url: `${
Expand All @@ -155,13 +173,13 @@ module.exports = {
},
description: `${lyrics.lyrics}`,
thumbnail: {
url: `${lyrics.thumbnail}`,
url: `${lyrics.albumArt}`,
},

timestamp: new Date(),
};

await interaction.followUp({
return await interaction.followUp({
embeds: [lyricsEmbed],
});
} catch (error) {
Expand Down

0 comments on commit 6d61d1f

Please sign in to comment.