Skip to content

Commit

Permalink
[New] Command playlist can now also delete playlists from the datab…
Browse files Browse the repository at this point in the history
…ase!
  • Loading branch information
naseif committed Nov 15, 2021
1 parent a2f7367 commit 45df016
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions commands/Music/playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,45 @@ module.exports = {
],
});
}

if (args[0] === "remove" && !args[1])
return await message.channel.send({
embeds: [
embedMessage(
"RED",
`Please provide the name of the playlist you want to remove!\n Available Playlists: \`${
filterPlaylists ? filterPlaylists.join(" - ") : "None"
}\``
),
],
});

if (args[0] === "remove" && args[1]) {
const playlistToRemove = await client.db.get(
`${message.guildId}_${args[1]}`
);

if (!playlistToRemove)
return await message.channel.send({
embeds: [
embedMessage(
"RED",
`There is no playlist with this name in my Database!`
),
],
});

await client.db.delete(`${message.guildId}_${args[1]}`);
return await message.channel.send({
embeds: [
embedMessage(
"#9dcc37",
`✅ | Playlist with alias \`${args[1]}\` has been removed`
),
],
});
}

const customPlaylist = await client.db.get(`${message.guildId}_${args[0]}`);

if (!customPlaylist)
Expand Down

0 comments on commit 45df016

Please sign in to comment.