"use strict";

const Discord = require('discord.js');
const config = require('./config.json');
const disco = new Discord.Client();
const prefix = config.prefix;
const allowedUsers = config.allowedUsers;
const roles = config.roleToDisco;

disco.on("ready", () => {
    disco.user.setPresence({ game: { name: `Disco Roles! Created by i am toast#1213` }, type: 0 });
    console.log("Disco role bot online! Created by i am toast.");
});

disco.on("message", message => {

  function discoRole() {
    let random = '#'+(Math.random()*0xFFFFFF<<0).toString(16);
    roles.forEach((role) => {
      let theRole = message.guild.roles.find("name", role);
      theRole.edit({color: random}).catch(e => {
        return message.channel.sendMessage(":x: **Error:** The role you specified in the `config.json` is either not a role on this server, or his a role higher than the highest role that I have.");
      });
    });
  }

  if(message.content.startsWith(prefix + "startdisco")) {
    if(allowedUsers.includes(message.author.id)) {
    setInterval(() => { discoRole(); }, config.ms);
    message.channel.sendMessage("```css\nDiscoing...```");
    message.channel.sendMessage("Please make sure you read the README, you could get IP banned from discord because of ratelimits.");
  } else {
    message.reply(`You do not have permission to disco. If you have downloaded this bot off of github please go to the config.json and add your user ID to the "allowedUsers" value.`);
  }
} else

if(message.content.startsWith(prefix + "stopdisco")) {
  if(allowedUsers.includes(message.author.id)) {
  message.channel.sendMessage("I've stopped discoing.");
  setTimeout(() => { console.log(process.exit(0)); }, 300);
} else {
  message.reply(`You do not have permission to disco. If you have downloaded this bot off of github please go to the config.json and add your user ID to the "allowedUsers" value.`);
  }
}

});

disco.login(config.token);

@@ -1,19 +1,4 @@
-%22use strict%22;%0A%0A
 cons
@@ -709,23 +709,16 @@
 nel.send
-Message
 (%22:x: **
@@ -1074,23 +1074,16 @@
 nel.send
-Message
 (%22%60%60%60css
@@ -1126,23 +1126,16 @@
 nel.send
-Message
 (%22Please
@@ -1566,15 +1566,8 @@
 send
-Message
 (%22I'

Update bot.js