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
17
server.js
17
server.js
|
@ -12,10 +12,13 @@ const {
|
|||
|
||||
client.commands = new Discord.Collection();
|
||||
client.serverPrefixes = new Discord.Collection();
|
||||
client.netmodules = new Discord.Collection();
|
||||
|
||||
var reloadCommands = require("./util/reloadCommands.js");
|
||||
const loadServerPrefixes = require('./util/loadServerPrefixes');
|
||||
const loadNetModules = require('./util/loadNetModules');
|
||||
reloadCommands(client)
|
||||
loadNetModules(client)
|
||||
|
||||
client.once('ready', () => {
|
||||
console.log('Ready!');
|
||||
|
@ -48,13 +51,23 @@ client.on('message', async message => {
|
|||
|
||||
const commandName = args.shift().toLowerCase();
|
||||
const command = client.commands.get(commandName);
|
||||
const netModule = client.netmodules.get(commandName);
|
||||
if (!message.guild) return;
|
||||
if (message.author.bot) return;
|
||||
if (!message.content.startsWith(prefix)) return;
|
||||
if (!command) return;
|
||||
if (!command){
|
||||
if (netModule){
|
||||
try {
|
||||
netModule.execute({message: message, args: args, client: client, prefix: prefix})
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (command.admin && owners.indexOf(message.author.id.toString()) == -1) return;
|
||||
try {
|
||||
command.execute({ message: message, args: args, client: client, prefix: prefix})
|
||||
command.execute({ message: message, args: args, client: client, prefix: prefix, owners: owners})
|
||||
} catch (error) {
|
||||
console.log(`${error}\n-------`)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue