{"size": 1261, "ext": "js", "max_stars_repo_path": "bot.js", "max_stars_repo_name": "Qwiko/Moverbot", "max_stars_repo_stars_event_min_datetime": "2018-09-19T14:09:56.000Z", "max_stars_repo_stars_event_max_datetime": "2018-09-19T14:09:56.000Z", "max_issues_repo_path": "bot.js", "max_issues_repo_name": "Qwiko/Moverbot", "max_issues_repo_issues_event_min_datetime": "2018-11-12T13:56:01.000Z", "max_issues_repo_issues_event_max_datetime": "2021-06-21T16:20:50.000Z", "max_forks_repo_path": "bot.js", "max_forks_repo_name": "Qwiko/Moverbot", "max_forks_repo_forks_event_min_datetime": "2020-11-24T20:47:48.000Z", "max_forks_repo_forks_event_max_datetime": "2020-11-24T20:47:48.000Z"}
{"max_stars_count": 1, "max_issues_count": 11, "max_forks_count": 1, "avg_line_length": 24.25, "max_line_length": 63, "alphanum_fraction": 0.6296590008}
/*
Author: Qwiko
A moverbot for Discord
*/

//Discord setup
const Discord = require("discord.js");
const client = new Discord.Client();

//lib setup and config
client.config = require("./files/config.json");

const fs = require("fs");

client.lib = require("./lib");

//db setup
client.lib.db.create(client);

//Loading events
fs.readdir("./events/", (err, files) => {
  if (err) return console.error(err);
  files.forEach((file) => {
    const event = require(`./events/${file}`);
    let eventName = file.split(".")[0];
    client.on(eventName, event.bind(null, client));
  });
});

client.commands = new Discord.Collection();

//Loading commands
fs.readdir("./commands/", (err, files) => {
  if (err) return console.error(err);
  files.forEach((file) => {
    if (!file.endsWith(".js")) return;
    let props = require(`./commands/${file}`);
    let commandName = file.split(".")[0];
    //console.log(`Attempting to load command ${commandName}`);
    if (props && props.help && props.help.enabled) {
      //Load only enabled commands
      client.commands.set(commandName, props);
      //Setting aliases
      props.help.aliases.forEach((alias) => {
        client.commands.set(alias, props);
      });
    }
  });
});

client.login(client.config.token);
