diff --git a/app.js b/app.js index c4e4a88..110f079 100644 --- a/app.js +++ b/app.js @@ -1,6 +1,5 @@ /* eslint no-console: 0 */ const Discord = require("discord.js"); - const client = new Discord.Client(); const setup = require("./setup.js"); var util = require("./src/util.js") @@ -30,7 +29,6 @@ module.exports.start = function(config) { } else if (i.type == "commands") { client.functions.types.commands.push(i.name); } - }) client.config = config; start(client, client.config, client.commanddata) @@ -39,17 +37,8 @@ module.exports.start = function(config) { return console.error("An error occurred while loading commands.", err) } console.log(err, err.stack) - }) - - - - } - - - - function start(client, config, commanddata) { var startedAt = new Date(); client.login(config.token) @@ -74,7 +63,6 @@ function start(client, config, commanddata) { } else { client.config.owner_id = application.owner.id } - }).catch((err) => { if (client.developer) { console.warn("Can't fetch application, error: \n", err) @@ -84,15 +72,11 @@ function start(client, config, commanddata) { return console.error("The bot can't find the owner_id set up inside your file, \nThis could be because it's not valid, or because you are not in a server with it, please invite it to a server where you are on.") } }) - - client.functions.boot.bootfuncs.forEach((data) => { function returnfunction() { return data.function(client) } - - setTimeout(function() { if (data.time > 0) { setInterval(returnfunction, data.time) @@ -101,24 +85,10 @@ function start(client, config, commanddata) { }, data.delay); }) - - - console.log(commanddata.commands.size + " commands | " + commanddata.aliases.size + " aliases, bot online") console.log("To add new commands, type \"" + config.prefix + "createcommand \" to generate a new template!") - - - - }) - - - client.on("message", (message) => { - - - - // commands if (!message.content.startsWith(config.prefix)) { dofuncs(client, message, "message").catch((data) => { @@ -155,8 +125,6 @@ function start(client, config, commanddata) { } }) } - - function doCommand(command, client, message) { command = client.commanddata.commands.get(command); if (command === undefined) { @@ -173,13 +141,11 @@ function doCommand(command, client, message) { if (message.author.id == client.config.owner_id) { message.channel.send("[EDB] Command: **" + command.name + "** | Requires the " + mod + " package to be installed.\nTo install this package, close the script and type: `npm install " + mod.slice(1, -1) + "`") } - } else { console.warn("Command: " + command.name + " | had an error. Show the developer of the command module that you are getting this error code: \n" + err) } } } - function dofuncs(client, message, type) { return new Promise(function(resolve, reject) { var funcnumber = 0; @@ -188,7 +154,6 @@ function dofuncs(client, message, type) { if (client.functions.types.messages.length == 0) { return resolve() } - client.functions.messages.messagefuncs.forEach(i => { var num = client.functions.messages.messagefuncs.size if (client.functions.types.messages.includes(i.name) == false) { @@ -254,17 +219,12 @@ function dofuncs(client, message, type) { done(number, num) } }) - - } - - function done(xnumber, num) { number = xnumber + 1 if (number == num) { return resolve() } } - }); }