Pastebin

discord rainbow role

discord rainbow role from Pastebin

Discord rainbow role Pastebin Discord rainbow role paste Discord rainbow roleplay details Discord rainbow role bot code Color code on discord for rainbow for roles snippet How to make a rainbow role i
    
        var Discord = require("discord.js");
var bot = new Discord.Client({
    bot: false
});
var config = {
	token: "", //put your token here
	debug: true, //set to false if you don't want console spam
	roleArray: [] //an array of role "hashs," use the hashRole function on a Discord role object to get it
};
process.on("exit", function(code) {
    console.info(`Exiting process with exit code ${code}.`);
});
process.on("unhandledRejection", (rej, p)=>{
    console.error("Unhandled Rejection:\n"+rej);
    if (rej instanceof Error) {
        if (/Error:\sSomething took too long to do|read\sECONNRESET|EAI_AGAIN/i.test(rej.message)) {
            process.exit(1);
        }
    }
});
function hashRole (role) {
    return new Buffer(role.id + ":" + role.guild.id).toString("base64");
}
function unhashRole (hash) {
    var split = new Buffer(hash, "base64").toString("ascii").split`:`;
    return bot.guilds.get(split[1]).roles.get(split[0]);
}
bot.on("ready", function() {
    console.log(`Ready and logged in as ${bot.user.username}#${bot.user.discriminator} (ID: ${bot.user.id})`);
    var rainbow=[0xdc143c, 0xff8c00, 0xffff00, 0x7cfc00, 0x000080, 0x4b0082, 0xee82ee];
    var rainbowIndex = 0;
    var rainbowRoles = config.roleArray.map(v => unhashRole(v)).filter(v => v);
    var rainbowInterval = setInterval(function(){
        rainbowIndex = (rainbowIndex + 1) % rainbow.length;
        rainbowRoles.map((v, i) => v.setColor(rainbow[rainbowIndex]).catch(err => {
            rainbowRoles.splice(i, 1);
        }));
    }, 1700);
});
if (config.debug) {
	bot.on("warn", console.warn);
	bot.on("debug", console.info);
}
bot.login(config.token);