1
0
mirror of https://github.com/musix-org/musix-oss synced 2025-06-16 18:56:00 +00:00

Update 3.0.2

This commit is contained in:
MatteZ02
2020-03-03 22:24:41 +02:00
parent 295f5521e9
commit 58c5c3065a
25 changed files with 108 additions and 70 deletions

22
commands/bass.js Normal file
View File

@ -0,0 +1,22 @@
module.exports = {
name: 'bass',
description: 'Bassboost command.',
alias: 'none',
usage: '<bass>',
cooldown: 5,
onlyDev: false,
permission: 'MANAGE_MESSAGES',
category: 'music',
execute(msg, args, client, Discord, prefix, command) {
const serverQueue = client.queue.get(msg.guild.id);
if (!args[1] && serverQueue) return msg.channel.send(`:loud_sound: The current bass is: **${serverQueue.bass}**`);
const bass = parseFloat(args[1]);
if (client.funcs.check(client, msg, command)) {
if (isNaN(bass)) return msg.channel.send('<:redx:674263474704220182> I\'m sorry, But you need to enter a valid __number__.');
if (bass > 100) return msg.channel.send('<:redx:674263474704220182> The max bass is `100`!');
if (bass < 0) return msg.channel.send('<:redx:674263474704220182> The volume needs to be a positive number!');
serverQueue.bass = bass;
return msg.channel.send(`<:volumehigh:674685637626167307> The bass level **${bass}** will be applied when the next song starts playing!`);
}
}
};

View File

@ -1,33 +0,0 @@
module.exports = {
name: 'disconnect',
alias: 'dc',
usage: '',
description: 'Disconnect the bot from a voice channel.',
onlyDev: true,
permission: 'MANAGE_CHANNELS',
category: 'util',
async execute(msg, args, client, Discord, prefix, command) {
const serverQueue = client.queue.get(msg.guild.id);
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!')
}
}
};

13
commands/end.js Normal file
View File

@ -0,0 +1,13 @@
module.exports = {
name: 'end',
alias: 'e',
usage: '',
description: 'end the queue',
onlyDev: true,
permission: 'dev',
category: 'util',
async execute(msg, args, client, Discord, prefix, command) {
client.queue.delete(guild.id);
msg.channel.send('Queue deleted!');
}
};

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 && !x.onlyDev).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

@ -22,9 +22,9 @@ module.exports = {
const option = require(`./settings/${file}`);
client.settingCmd.set(option.name, option);
}
fs.readdirSync(path.join(__dirname, 'funcs')).forEach(filename => {
/*fs.readdirSync(path.join(__dirname, 'funcs')).forEach(filename => {
this.funcs[filename.slice(0, -3)] = require(`../struct/funcs/${filename}`);
});
});*/
msg.channel.send('All files reloaded!');
}
};

View File

@ -10,7 +10,7 @@ module.exports = {
const serverQueue = client.queue.get(msg.guild.id);
if (client.funcs.check(client, msg, command)) {
if (!args[1]) return msg.channel.send('<:redx:674263474704220182> Please provide a song position in queue for me to remove!');
const pos = parseInt(args[1] - 1);
const pos = parseInt(args[1]);
if (isNaN(pos)) return msg.channel.send('<:redx:674263474704220182> You need to enter a number!');
if (pos < 1) return msg.channel.send('<:redx:674263474704220182> That songs does not exist!');
if (pos > serverQueue.songs.length) return msg.channel.send(`<:redx:674263474704220182> There is only ${serverQueue.songs.length} amount of songs in the queue!`);

View File

@ -7,9 +7,8 @@ module.exports = {
permission: 'none',
category: 'util',
async execute(msg, args, client, Discord, prefix, command) {
client.destroy()
const MusicClient = require('../struct/client.js');
const newClient = new MusicClient({});
client.destroy();
require('../index.js');
msg.channel.send('restarted!');
}
};

View File

@ -17,6 +17,7 @@ module.exports = {
if (pos < 0) return msg.channel.send('<:redx:674263474704220182> The seeking point needs to be a positive number!');
if (pos > data.length_seconds) return msg.channel.send(`<:redx:674263474704220182> The lenght of this song is ${data.length_seconds} seconds! You can't seek further than that!`);
serverQueue.connection.dispatcher.end('seek');
serverQueue.endReason = "seek";
client.funcs.play(msg.guild, serverQueue.songs[0], client, msg, pos, false);
}
}

View File

@ -14,6 +14,7 @@ module.exports = {
.addField('permissions', 'Change whether to require permissions to use eg `skip, stop, pause, loop, etc...`', true)
.addField('setdj', 'Set a DJ role. This will allow chosen users to freely use all Musix commands. This will automatically set the `permissions` settings to true in order for the `DJ` role to have effect!', true)
.addField('announcesongs', 'Whether to announce songs that start playing or not.')
.addField('bass', 'Change the default bass level', true)
.setFooter(`how to use: ${prefix}settings <Setting name> <value>`)
.setAuthor(client.user.username, client.user.displayAvatarURL)
.setColor(client.embedColor)

14
commands/settings/bass.js Normal file
View File

@ -0,0 +1,14 @@
module.exports = {
name: 'bass',
async execute(msg, args, client, Discord, prefix) {
if (!args[2]) return msg.channel.send('Currect bass level: ' + client.global.db.guilds[msg.guild.id].bass);
if (args[2] === "false") {
client.global.db.guilds[msg.guild.id].bass = false;
msg.channel.send(`Bass is now false!`);
}
const level = parseInt(args[2]);
if (isNaN(level)) return msg.channel.send('You need to provide a number?');
client.global.db.guilds[msg.guild.id].bass = level;
msg.channel.send(`Bass level is now ${level}!`);
}
};

View File

@ -28,6 +28,7 @@ module.exports = {
};
function skipSong(serverQueue, msg) {
msg.channel.send('<:skip:674685614221688832> Skipped the song!');
serverQueue.endReason = "skip";
serverQueue.connection.dispatcher.end('skipped');
};
function vote(serverQueue, msg) {

View File

@ -10,7 +10,7 @@ module.exports = {
const serverQueue = client.queue.get(msg.guild.id);
if (client.funcs.check(client, msg, command)) {
if (!args[1]) return msg.channel.send(`<:redx:674263474704220182> correct usage: \`${command.usage}\``);
const point = parseInt(args[1]);
const point = parseInt(args[1] - 1);
if (isNaN(point)) return msg.channel.send('<:redx:674263474704220182> I\'m sorry, But you need to enter a valid __number__.');
if (point > serverQueue.songs.size) return msg.channel.send('<:redx:674263474704220182> That song does not exist!');
if (point < 1) return msg.channel.send('<:redx:674263474704220182> You can\'t skip to the song currently playing!');
@ -19,6 +19,7 @@ module.exports = {
i++;
serverQueue.songs.shift();
}
serverQueue.endReason = "skipto";
serverQueue.connection.dispatcher.end('skipto');
}
}

View File

@ -8,7 +8,6 @@ module.exports = {
category: 'info',
execute(msg, args, client, Discord, prefix) {
const uptime = client.funcs.msToTime(client.uptime, "dd:hh:mm:ss");
const ping = Math.floor(client.ping * 10) / 10;
msg.channel.send('<a:loading:674284196700618783> Pinging...').then(m => {
const latency = m.createdTimestamp - msg.createdTimestamp;

View File

@ -11,6 +11,7 @@ module.exports = {
if (client.funcs.check(client, msg, command)) {
serverQueue.songs = [];
serverQueue.looping = false;
serverQueue.endReason = "stop";
serverQueue.connection.dispatcher.end('Stopped');
msg.channel.send('<:stop:674685626108477519> Stopped the music!')
}