Discord.js v12 make Rainbow Role

I want to make a rainbow role(changes all 60seconds the color).
Is this possible?
I have a general understanding of discord.js.

Thanks allot dor trying to help.

>Solution :

I created a tutorial in german on YouTube. If you understand german and want to exectly understand what the code does, check it out here!

Here is a basic code for a rainbow role, you need to adjust some things to work for you.

client.on('ready' , async() =>{
    const guild = client.guilds.cache.get('///Your guild ID');
    colors = ['///Enter a list of hex codes here'];
    var role = guild.roles.cache.get('///Your Rainbow Role ID here!')
    setInterval(() => {
        const roleCount = guild.roles.cache.get(role).members.size;
        if(roleCount >= 1){
        var random = Math.floor(Math.random() * colors.length);
        color: colors[random]
        console.log('Rainbow Color changed, it is now: ' + colors[random])
        console.log('No user with rainbow role')
    }, 600*1000)

Leave a Reply