mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2025-07-01 08:23:37 +00:00
Large update
This commit is contained in:
@ -1,31 +0,0 @@
|
||||
module.exports = {
|
||||
name: 'cmduses',
|
||||
alias: 'none',
|
||||
usage: '',
|
||||
description: 'list all commands and how many times they\'ve been used',
|
||||
onlyDev: true,
|
||||
permission: 'dev',
|
||||
category: 'info',
|
||||
async execute(msg, args, client, Discord) {
|
||||
const cmduses = [];
|
||||
client.commands.forEach((value, key) => {
|
||||
cmduses.push([key, value.uses]);
|
||||
});
|
||||
cmduses.sort((a, b) => {
|
||||
return b[1] - a[1];
|
||||
});
|
||||
const cmdnamelength = Math.max(...cmduses.map(x => x[0].length)) + 4;
|
||||
const numberlength = Math.max(...cmduses.map(x => x[1].toString().length), 4);
|
||||
const markdownrows = ['Command' + ' '.repeat(cmdnamelength - 'command'.length) + ' '.repeat(numberlength - 'uses'.length) + 'Uses'];
|
||||
cmduses.forEach(x => {
|
||||
if (x[1] > 0) markdownrows.push(x[0] + '.'.repeat(cmdnamelength - x[0].length) + ' '.repeat(numberlength - x[1].toString().length) + x[1].toString());
|
||||
});
|
||||
const embed = new Discord.MessageEmbed();
|
||||
embed
|
||||
.setTitle('Musix Command Usage During Current Uptime')
|
||||
.setDescription('```ml\n' + markdownrows.join('\n') + '\n```')
|
||||
.setFooter('These statistics are from the current uptime.')
|
||||
.setColor(client.config.embedColor);
|
||||
msg.channel.send(embed);
|
||||
},
|
||||
};
|
@ -1,24 +0,0 @@
|
||||
module.exports = {
|
||||
name: 'eval',
|
||||
alias: 'e',
|
||||
usage: '<code>',
|
||||
description: 'Evaluation command. DEV ONLY!',
|
||||
onlyDev: true,
|
||||
permission: 'dev',
|
||||
category: 'util',
|
||||
async execute(msg, args, client, Discord, prefix) {
|
||||
const radio = client.radio.get(msg.guild.id);
|
||||
const input = msg.content.slice(prefix.length + 4);
|
||||
let output;
|
||||
try {
|
||||
output = await eval(input);
|
||||
} catch (error) {
|
||||
output = error.toString();
|
||||
}
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle('Evaluation Command')
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription(`Input: \`\`\`js\n${input.replace(/; /g, ';').replace(/;/g, ';\n')}\n\`\`\`\nOutput: \`\`\`\n${output}\n\`\`\``);
|
||||
return msg.channel.send(embed);
|
||||
},
|
||||
};
|
@ -1,24 +0,0 @@
|
||||
module.exports = {
|
||||
name: 'join',
|
||||
alias: 'j',
|
||||
usage: '',
|
||||
description: 'Make Musix join the channel your channel',
|
||||
onlyDev: true,
|
||||
permission: 'none',
|
||||
category: 'util',
|
||||
async execute(msg, args, client, Discord, prefix) {
|
||||
try {
|
||||
const radio = client.radio.get(msg.guild.id);
|
||||
const voiceChannel = msg.member.voice.channel;
|
||||
const connection = await voiceChannel.join();
|
||||
if (radio) {
|
||||
radio.connection = connection;
|
||||
}
|
||||
msg.channel.send(`<:green_check_mark:674265384777416705> Joined ${voiceChannel.name}!`);
|
||||
} catch (error) {
|
||||
client.radio.delete(msg.guild.id);
|
||||
client.channels.fetch(client.config.debug_channel).send("Error with connecting to voice channel: " + error);
|
||||
return msg.channel.send(`<:redx:674263474704220182> An error occured: ${error}`);
|
||||
}
|
||||
}
|
||||
};
|
@ -7,7 +7,6 @@ module.exports = {
|
||||
permission: 'none',
|
||||
category: 'music',
|
||||
async execute(msg, args, client, Discord, prefix) {
|
||||
const searchString = args.slice(1).join(" ");
|
||||
const url = args[1] ? args[1].replace(/<(.+)>/g, "$1") : "";
|
||||
const radio = client.radio.get(msg.guild.id);
|
||||
const voiceChannel = msg.member.voice.channel;
|
||||
@ -24,6 +23,30 @@ module.exports = {
|
||||
if (!permissions.has('SPEAK')) {
|
||||
return msg.channel.send('<:redx:674263474704220182> I cannot speak in your voice channel, make sure I have the proper permissions!');
|
||||
}
|
||||
return client.funcs.handleRadio(msg, voiceChannel, client, url);
|
||||
|
||||
if (radio) {
|
||||
radio.connection.dispatcher.end();
|
||||
}
|
||||
|
||||
const construct = {
|
||||
textChannel: msg.channel,
|
||||
voiceChannel: voiceChannel,
|
||||
connection: null,
|
||||
playing: false,
|
||||
url: url,
|
||||
name: null,
|
||||
volume: client.config.volume,
|
||||
};
|
||||
client.radio.set(msg.guild.id, construct);
|
||||
|
||||
try {
|
||||
const connection = await voiceChannel.join();
|
||||
construct.connection = connection;
|
||||
client.funcs.play(msg.guild, client, url);
|
||||
} catch (error) {
|
||||
client.radio.delete(msg.guild.id);
|
||||
client.debug_channel.send("Error with connecting to voice channel: " + error);
|
||||
return msg.channel.send(`<:redx:674263474704220182> An error occured: ${error}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1,30 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path')
|
||||
|
||||
module.exports = {
|
||||
name: 'reload',
|
||||
alias: 'none',
|
||||
usage: '',
|
||||
description: 'Reload all files',
|
||||
onlyDev: true,
|
||||
permission: 'none',
|
||||
category: 'util',
|
||||
async execute(msg, args, client, Discord, prefix, command) {
|
||||
const commandFiles = fs.readdirSync(path.join(path.dirname(__dirname), 'commands')).filter(f => f.endsWith('.js'));
|
||||
for (const file of commandFiles) {
|
||||
const command = require(`./${file}`);
|
||||
command.uses = 0;
|
||||
client.commands.set(command.name, command);
|
||||
client.commandAliases.set(command.alias, command);
|
||||
}
|
||||
const settingFiles = fs.readdirSync(path.join(path.dirname(__dirname), 'commands/settings')).filter(f => f.endsWith('.js'));
|
||||
for (const file of settingFiles) {
|
||||
const option = require(`./settings/${file}`);
|
||||
client.settingCmd.set(option.name, option);
|
||||
}
|
||||
/*fs.readdirSync(path.join(__dirname, 'funcs')).forEach(filename => {
|
||||
this.funcs[filename.slice(0, -3)] = require(`../struct/funcs/${filename}`);
|
||||
});*/
|
||||
msg.channel.send('All files reloaded!');
|
||||
}
|
||||
};
|
@ -1,14 +0,0 @@
|
||||
module.exports = {
|
||||
name: 'restart',
|
||||
alias: 'none',
|
||||
usage: '',
|
||||
description: 'Restart the bot',
|
||||
onlyDev: true,
|
||||
permission: 'none',
|
||||
category: 'util',
|
||||
async execute(msg, args, client, Discord, prefix, command) {
|
||||
client.destroy();
|
||||
require('../index.js');
|
||||
msg.channel.send('restarted!');
|
||||
}
|
||||
};
|
@ -9,7 +9,7 @@ module.exports = {
|
||||
execute(msg, args, client, Discord, prefix, command) {
|
||||
const radio = client.radio.get(msg.guild.id);
|
||||
if (client.funcs.check(client, msg, command)) {
|
||||
radio.connection.dispatcher.end('Stopped');
|
||||
radio.connection.dispatcher.end();
|
||||
msg.channel.send('<:stop:674685626108477519> Stopped the music!')
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ module.exports = {
|
||||
description: 'Volume command.',
|
||||
alias: 'none',
|
||||
usage: '<volume>',
|
||||
cooldown: 5,
|
||||
onlyDev: false,
|
||||
permission: 'MANAGE_MESSAGES',
|
||||
category: 'music',
|
||||
|
Reference in New Issue
Block a user