1
0
mirror of https://github.com/musix-org/musix-oss synced 2025-06-17 04:26:00 +00:00
This commit is contained in:
MatteZ02
2020-02-10 21:04:42 +02:00
parent 8647d8782f
commit c1bbdf9532
10 changed files with 45 additions and 32 deletions

View File

@ -3,14 +3,31 @@ module.exports = {
alias: 'dc',
usage: 'disconnect',
description: 'Disconnect the bot from a voice channel.',
onlyDev: false,
onlyDev: true,
permission: 'MANAGE_CHANNELS',
category: 'util',
async execute(msg, args, client, Discord, prefix, command) {
const serverQueue = client.queue.get(msg.guild.id);
if (client.funcs.check(client, msg, command)) {
serverQueue.voiceChannel.leave();
if (msg.author.id !== client.config.devId) {
if (msg.member.voice.channel !== serverQueue.voiceChannel) return msg.channel.send(`<:redx:674263474704220182> I'm sorry but you need to be in the same voice channel as Musix to use this command!`);
if (client.global.db.guilds[msg.guild.id].permissions === true) {
if (client.global.db.guilds[msg.guild.id].dj) {
if (!msg.member.roles.has(client.global.db.guilds[msg.guild.id].djrole)) {
msg.channel.send('<:redx:674263474704220182> You need the `DJ` role to use this command!');
};
} else if (!permissions.has(command.permission)) {
msg.channel.send(`<:redx:674263474704220182> You need the \`${command.permission}\` permission to use this command!`);
}
};
}
if (serverQueue && serverQueue.playing) {
return msg.channel.send('<:redx:674263474704220182> There is something playing! Use the `stop` command instead!');
}
if (msg.guild.voiceConnection) {
msg.guild.voiceConnection.channel.leave();
msg.channel.send('<:green_check_mark:674265384777416705> Left the voice channel!');
} else {
msg.channel.send('<:redx:674263474704220182> i\'m not connected to a voice channel!')
}
}
};

View File

@ -23,7 +23,7 @@ module.exports = {
}
let commands = '';
for (let i = 0; i < categories.length; i++) {
commands += `**» ${categories[i].toUpperCase()}**\n${client.commands.filter(x => x.category === categories[i] && !x.omitFromHelp).map(x => `\`${x.name}\``).join(', ')}\n`;
commands += `**» ${categories[i].toUpperCase()}**\n${client.commands.filter(x => x.category === categories[i] && !x.omitFromHelp && !x.onlyDev).map(x => `\`${x.name}\``).join(', ')}\n`;
}
const embed = new Discord.MessageEmbed()
.setTitle(`${client.user.username} help:`)

View File

@ -3,7 +3,7 @@ module.exports = {
alias: 'j',
usage: 'join',
description: 'Make Musix join the channel your channel',
onlyDev: false,
onlyDev: true,
permission: 'none',
category: 'util',
async execute(msg, args, client, Discord, prefix) {

View File

@ -11,18 +11,6 @@ module.exports = {
if (client.funcs.check(client, msg, command)) {
client.funcs.shuffle(serverQueue.songs);
msg.channel.send('<:shuffle:674685595980791871> Queue suffled!');
/*let currentIndex = serverQueue.songs.length,
temporaryValue,
randomIndex;
while (0 !== currentIndex) {
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
temporaryValue = serverQueue.songs[currentIndex];
serverQueue.songs[currentIndex] = serverQueue.songs[randomIndex];
serverQueue.songs[randomIndex] = temporaryValue;*
}*/
}
}
};