1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-12-22 18:03:17 +00:00
musix-oss/commands/playlist.js

45 lines
2.5 KiB
JavaScript
Raw Normal View History

2019-10-13 17:52:51 +00:00
const YouTube = require("simple-youtube-api");
const he = require('he');
2024-02-09 09:53:30 +00:00
const { EmbedBuilder, PermissionFlagsBits } = require("discord.js");
2019-10-13 17:52:51 +00:00
2019-10-12 14:40:00 +00:00
module.exports = {
name: 'playlist',
usage: '[option]',
description: 'Save and load queues',
alias: 'pl',
2019-10-12 14:40:00 +00:00
cooldown: 10,
2024-02-09 09:53:30 +00:00
async execute(message, args, client, prefix) {
const embed = new EmbedBuilder()
.setTitle('Options for playlist!')
2024-02-09 09:53:30 +00:00
.addFields(
{ name: 'play', value: 'Play the guild specific queue.', inline: true },
{ name: 'save', value: 'Save the currently playing queue. Note that this will overwrite the currently saved queue!', inline: true },
{ name: 'add', value: 'Add songs to the playlist. Like song selection', inline: true },
{ name: 'remove', value: 'Remove songs from the playlist.', inline: true },
{ name: 'list', value: 'Display the playlist.', inline: true }
)
.setFooter({ text: `how to use: ${prefix}playlist <Option> <Optional option>` })
.setAuthor({ name: client.user.username, iconURL: client.user.avatarURL()})
2019-12-05 13:17:15 +00:00
.setColor(client.config.embedColor)
2019-10-12 15:01:13 +00:00
const permissions = message.channel.permissionsFor(message.author);
2024-02-09 09:53:30 +00:00
if (client.global.db.guilds[message.guild.id].dj) {
if (!message.member.roles.cache.has(client.global.db.guilds[message.guild.id].djrole)) return message.channel.send(':x: You need the `DJ` role to modify or play the playlist!');
} else if (!permissions.has(PermissionFlagsBits.ManageGuild)) return message.channel.send(':x: You need the `MANAGE_SERVER` permission to modify the playlist!');
2019-10-12 14:40:00 +00:00
if (client.global.db.guilds[message.guild.id].premium) {
if (args[1]) {
const optionName = args[1].toLowerCase();
const option = client.playlistCmd.get(optionName) || client.playlistCmd.find(cmd => cmd.aliases && cmd.aliases.includes(optionName));
2024-02-09 09:53:30 +00:00
if (!option) return message.channel.send({ embeds: [embed] });
try {
2024-02-09 09:53:30 +00:00
option.execute(message, args, client, prefix);
} catch (error) {
2024-02-09 09:53:30 +00:00
message.reply(`:x: there was an error trying to execute that option!`);
console.log(error);
2019-10-13 17:52:51 +00:00
}
2019-10-12 14:40:00 +00:00
} else {
2024-02-09 09:53:30 +00:00
return message.channel.send({ embeds: [embed] });
2019-10-12 14:40:00 +00:00
}
} else return message.channel.send(":x: This is not a premium guild!");
},
};