UnhandledPromiseRejectionWarning: TypeError [INVALID_TYPE]: Supplied roles is not an Role, Snowflake or Ar

Viewed 5656

I'm currently trying to set up a discord bot and am currently struggling with making it give roles to members.

The code looks like this:

client.on('message', (message) => {

if (message.content == '!pronouns she/her')
{
    message.member.roles.add(726463067331887124)
    message.channel.send(`Role added: she/her`);
}

(it repeats for other pronouns but in itself its always the same)

when i try to run the command on the discord server it give me this error message in Visual Studio Code:

UnhandledPromiseRejectionWarning: TypeError [INVALID_TYPE]: Supplied roles is not an Role, Snowflake or Array or Collection of Roles or Snowflakes.

and now im kinda stuck oof

1 Answers

You're missing ""

message.member.roles.add("726463067331887124")
Related