Discord.js bot – creating roles on setup results in RangeError

I’m making a discord bot and in !setup 1 I would like to create a few roles.
I tried this code:`

            message.channel.send(`setting up roles...`);
            guild.roles.create({
                data: {
                    name: 'Administrator', 
                    color: 'GOLD', 
                    permissions: ['ADMINISTRATOR']
                }
            });
            guild.roles.create({
                data: {
                     name: 'Moderator',
                     color: 'GREEN', 
                     permissions: {
                         KICK_MEMBER : true,
                         MANAGE_MESSAGES: true,
                         MENTION_EVERYONE: true,
                         MUTE_MEMBERS: true,
                         CHANGE_NICKNAME: true,
                         MANAGE_NICKNAMES: true,

                     }
                    }
                });
            guild.roles.create({ 
                data: { 
                    name: 'Muted',
                    permissions: {
                        SEND_MESSAGES: false,
                        ADD_REACTIONS: false,
                    }
                } 
            });

but I’m getting the following error:

RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number.

Does anyone know how to fix this?

Earlier on I defined guild.

12 thoughts on “Discord.js bot – creating roles on setup results in RangeError”

  1. What i don’t understood is in reality how you are now not actually
    a lot more neatly-appreciated than you might be now. You are very intelligent.
    You already know therefore significantly relating to this matter, produced me individually believe
    it from so many various angles. Its like women and
    men don’t seem to be interested unless it’s something to do with Girl gaga!

    Your own stuffs outstanding. All the time maintain it
    up! http://www.deinformedvoters.org/hydroxychloroquine

    Reply

Leave a Comment