R
R
RogueQ2020-11-12 22:27:40
Node.js
RogueQ, 2020-11-12 22:27:40

How to fix a command that makes a rainbow role?

module.exports.run = async(bot, message, args) => {

    if(!message.guild.member(bot.user).hasPermission('MANAGE_ROLES')) return;
    var colors = ['#FF0000','#FF7F00','#FFFF00','#0000FF','4B0082','#8F00FF'];
    for(let i = 0; i<= colors.length;i++){
        var role = message.guild.roles.find(role => role.name === "Welcome");
        setInterval(() => {
            role.edit({
                color: colors[i]
            })
        }, 5000);
      }
    }
    
    module.exports.help = {
        name: 'rainbowrole'
    }

TypeError: Cannot read property 'edit' of null - Error
Please help me fix it

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita Kudrin, 2020-11-12
@RogueQ

Discord simply doesn't allow people/bots to change roles if they send too many role change requests.
You can use different accounts, just change them periodically, but it’s better, of course, not to violate the terms of use.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question