mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-29 00:24:58 +05:00
42 lines
No EOL
974 B
JavaScript
42 lines
No EOL
974 B
JavaScript
const Command = require("../../base/Command");
|
|
|
|
class RemovePlaylist extends Command {
|
|
constructor(client) {
|
|
super(client, {
|
|
name: "removeplaylist",
|
|
dirname: __dirname,
|
|
enabled: true,
|
|
guildOnly: true,
|
|
aliases: ["rpl", "removepl"],
|
|
memberPermissions: [],
|
|
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
nsfw: false,
|
|
ownerOnly: false,
|
|
cooldown: 3000
|
|
});
|
|
}
|
|
|
|
async run(message, args, data) {
|
|
const name = args.join(" ");
|
|
if (!name) return message.error("music/createplaylist:NO_NAME");
|
|
|
|
const playlists = data.userData.playlists;
|
|
for (const playlist of playlists) {
|
|
if (!playlist.name === name) return message.error("music/removeplaylist:NOT_FOUND", {
|
|
name
|
|
});
|
|
|
|
const index = playlists.indexOf(playlist);
|
|
playlists.splice(index, 1);
|
|
|
|
data.userData.markModified("playlists");
|
|
data.userData.save();
|
|
|
|
message.success("music/removeplaylist:REMOVED", {
|
|
name
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = RemovePlaylist; |