Harvey
Harvey

Reputation: 3

I keep receiving a error when trying to give roles

I have a small piece of code that reads from a mongodb database and give them the role in the database

The command requires the user to tag the person they wish to update, what am i doing wrong?

msg.mentions.members.first().addRole(msg.guild.roles.find(r => r.name === result[0].MainRank));

This is the error:

TypeError: msg.guild.roles.find is not a function

Upvotes: 0

Views: 54

Answers (1)

elvira.genkel
elvira.genkel

Reputation: 1333

You now have to use msg.guild.roles.cache.find, since v12 uses Managers.

Upvotes: 1

Related Questions