diff --git a/commands/Music/playlists.js b/commands/Music/playlists.js index 01fec0dc..0b349bec 100644 --- a/commands/Music/playlists.js +++ b/commands/Music/playlists.js @@ -25,13 +25,11 @@ class Playlists extends Command { let playlist; for (const pl of playlists) { - if (pl.name === name) { - playlist = pl; - } else { - message.error("music/removeplaylist:NOT_FOUND", { - name - }); - } + if (!pl.name === name) return message.error("music/removeplaylist:NOT_FOUND", { + name + }); + + playlist = pl; } const embed = new Discord.MessageEmbed() diff --git a/commands/Music/playplaylist.js b/commands/Music/playplaylist.js index d7d475c4..49673bb1 100644 --- a/commands/Music/playplaylist.js +++ b/commands/Music/playplaylist.js @@ -23,13 +23,11 @@ class PlayPlaylists extends Command { const name = args.join(" "); let playlist; for (const pl of data.userData.playlists) { - if (pl.name === name) { - playlist = new DisTube.Playlist(pl); - } else { - return message.error("music/removeplaylist:NOT_FOUND", { - name - }); - } + if (!pl.name === name) return message.error("music/removeplaylist:NOT_FOUND", { + name + }); + + playlist = new DisTube.Playlist(pl); } if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); diff --git a/commands/Music/removeplaylist.js b/commands/Music/removeplaylist.js index ae9f971e..a0a7268a 100644 --- a/commands/Music/removeplaylist.js +++ b/commands/Music/removeplaylist.js @@ -22,21 +22,19 @@ class RemovePlaylist extends Command { const playlists = data.userData.playlists; for (const playlist of playlists) { - if (playlist.name === name) { - const index = playlists.indexOf(playlist); - playlists.splice(index, 1); + if (!playlist.name === name) return message.error("music/removeplaylist:NOT_FOUND", { + name + }); - data.userData.markModified("playlists"); - data.userData.save(); + const index = playlists.indexOf(playlist); + playlists.splice(index, 1); - message.success("music/removeplaylist:REMOVED", { - name - }); - } else { - message.error("music/removeplaylist:NOT_FOUND", { - name - }); - } + data.userData.markModified("playlists"); + data.userData.save(); + + message.success("music/removeplaylist:REMOVED", { + name + }); } } }