{"size": 1841, "ext": "js", "max_stars_repo_path": "bot.js", "max_stars_repo_name": "Crunnie/RudyKocur", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "bot.js", "max_issues_repo_name": "Crunnie/RudyKocur", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "bot.js", "max_forks_repo_name": "Crunnie/RudyKocur", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 27.8939393939, "max_line_length": 71, "alphanum_fraction": 0.6203150462}
const http = require('http');
const express = require('express');
const app = express();
app.get("/", (request, response) => {
  console.log(Date.now() + " Ping Received");
  response.sendStatus(200);
});
app.listen(process.env.PORT);
setInterval(() => {
  http.get(`http://${process.env.PROJECT_DOMAIN}.glitch.me/`);
}, 280000);

const Discord = require('discord.js');
const bot = new Discord.Client();
const botSettings = require('./config.json');
const fs = require("fs");

bot.commands = new Discord.Collection();


fs.readdir('./cmds/', (err, files) => {
    if(err) console.error(err);

    let jsFiles = files.filter(f => f.split(".").pop () === "js");
    if(jsFiles.length<= 0) {
        console.log("No commands to load!");
        return;
    }

    console.log(`Loading ${jsFiles.length} commands!`);

    jsFiles.forEach((f, i) => {
        let props = require(`./cmds/${f}`);
        console.log(`${i + 1}: ${f} loaded!`);
        bot.commands.set(props.help.name, props);
    });
});

bot.on('ready', () => {
    console.log(`${bot.user.username} is ready for deployment!`);
    console.log(`ID: ${bot.user.id}, Server Count:${bot.guilds.size}`);
    
    bot.user.setActivity(`oblizywanie łapek || rpomoc`)
    bot.user.setStatus("online");
    console.log("Game and Status has been set!");
    console.log(`${bot.user.username} is awaiting commands!`);
});

bot.on('message', async message => {
    if(message.author.bot) return;
    if(message.channel.type === "dm") return;

    let prefix = botSettings.prefix
    let messageArray = message.content.split(/\s+/g);
    let command = messageArray[0]
    let args = messageArray.slice(1);

    if(!command.startsWith(prefix)) return;

    let cmd = bot.commands.get(command.slice(prefix.length));
    if(cmd) cmd.run(bot, message, args);
});


bot.login(botSettings.token);
