mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 21:24:59 +05:00
45 lines
No EOL
1 KiB
JavaScript
45 lines
No EOL
1 KiB
JavaScript
const Command = require("../../base/Command");
|
|
|
|
class CreatePlaylist extends Command {
|
|
constructor(client) {
|
|
super(client, {
|
|
name: "createplaylist",
|
|
dirname: __dirname,
|
|
enabled: true,
|
|
guildOnly: true,
|
|
aliases: ["cpl", "createpl"],
|
|
memberPermissions: [],
|
|
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
nsfw: false,
|
|
ownerOnly: false,
|
|
cooldown: 3000
|
|
});
|
|
}
|
|
|
|
async run(message, args, data) {
|
|
args = args.join(" ").split(" | ");
|
|
|
|
const name = args[0];
|
|
const songs = args[1].split(" ");
|
|
if (!name) return message.error("music/createplaylist:NO_NAME");
|
|
if (!songs) return message.error("music/createplaylist:NO_SONGS");
|
|
|
|
const playlist = await this.client.player.createCustomPlaylist(songs, {
|
|
member: message.member,
|
|
properties: {
|
|
name
|
|
},
|
|
parallel: true
|
|
});
|
|
|
|
data.userData.playlists.push(playlist);
|
|
data.userData.markModified("playlists");
|
|
data.userData.save();
|
|
|
|
message.success("music/createplaylist:CREATED", {
|
|
name
|
|
});
|
|
}
|
|
}
|
|
|
|
module.exports = CreatePlaylist; |