Skip to content

Commit

Permalink
[Fix] Fixed a bug with the lyrics command where the bot would crash i…
Browse files Browse the repository at this point in the history
…f there are no songs playing while searching
  • Loading branch information
naseif committed Oct 1, 2021
1 parent 1e87e64 commit b3993b8
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions commands/music/lyrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,28 @@ module.exports = {
const songString = interaction.options.getString("song");
const lyricsClient = Lyrics.init();
const queue = client.player.getQueue(interaction.guild);

let songTitle;

if (songString) {
songTitle = songString;
} else {
songTitle = queue.current.title;
if (!queue)
return await interaction.followUp({
embeds: [
embedMessage(
"#9dcc37",
"❌ There is no music playing to search for lyrics!"
),
],
});
if (queue.current.title) {
songTitle = queue.current.title;

const filterName = queue.current.title.indexOf("(");
const filterName = queue.current.title.indexOf("(");

if (filterName !== -1) {
songTitle = songTitle.slice(0, filterName);
if (filterName !== -1) {
songTitle = songTitle.slice(0, filterName);
}
}
}

Expand Down

0 comments on commit b3993b8

Please sign in to comment.