Add ability to upload modules to the bot via discord
* Remove unused dependencies * Add basic downloading of modules * Add valid-url as dependency * Add loading/reloading of netmodules * Add support for help on netmodules * Add whitelist for netmodules
This commit is contained in:
parent
88100600b9
commit
d636b39d7a
6 changed files with 126 additions and 127 deletions
|
@ -5,9 +5,19 @@ const Discord = require('discord.js');
|
|||
module.exports = {
|
||||
name: 'help',
|
||||
description: 'List all available commands.',
|
||||
execute({message, args, prefix}) {
|
||||
execute({ message, args, prefix }) {
|
||||
var commands = " "
|
||||
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
|
||||
let commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
|
||||
let x = 0
|
||||
if (args[0] == "netload") {
|
||||
commandFiles = fs.readdirSync('./netload').filter(file => file.endsWith('.js'));
|
||||
if (commandFiles.length == 0) {
|
||||
message.channel.send("There are no netmodules currently loaded.")
|
||||
x = 1;
|
||||
}
|
||||
|
||||
}
|
||||
if (x == 1) return;
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setColor(15780145)
|
||||
|
@ -20,12 +30,12 @@ module.exports = {
|
|||
const command = require(`./${file}`);
|
||||
|
||||
|
||||
if(args[0] == "admin"){
|
||||
if (args[0] == "admin") {
|
||||
if (command.admin && !command.disabled)
|
||||
commands = commands + `${prefix}${command.name} | ${command.description}\n`
|
||||
}else
|
||||
if(!command.admin && !command.disabled)
|
||||
commands = commands + `${prefix}${command.name} | ${command.description}\n`
|
||||
} else
|
||||
if (!command.admin && !command.disabled)
|
||||
commands = commands + `${prefix}${command.name} | ${command.description}\n`
|
||||
}
|
||||
embed.addFields(
|
||||
{ name: "General", value: commands },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue