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:
SileNce5k 2021-03-15 23:29:49 +01:00 committed by GitHub
parent 88100600b9
commit d636b39d7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 126 additions and 127 deletions

View file

@ -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-------`)
}