mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 13:14:58 +05:00
44 lines
No EOL
990 B
JavaScript
44 lines
No EOL
990 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[0];
|
|
if (!name) return message.error("music/createplaylist:NO_NAME");
|
|
|
|
const playlists = data.userData.playlists;
|
|
for (const playlist of playlists) {
|
|
if (playlist.name === name) {
|
|
const index = playlists.indexOf(playlist);
|
|
playlists.splice(index, 1);
|
|
|
|
data.userData.markModified("playlists");
|
|
data.userData.save();
|
|
|
|
message.success("music/removeplaylist:REMOVED", {
|
|
name
|
|
});
|
|
} else {
|
|
message.error("music/removeplaylist:NOT_FOUND", {
|
|
name
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = RemovePlaylist; |