Elitezen
Elitezen

Reputation: 6730

message.guild.roles.find is not a function

Im trying to add a mute command by following a tutorial. On the video message.guild.roles.find is used to store a role in a variable. Today this throws an error of not a function

The video was made in 2018. Is message.guild.roles.find deprecated?

let mainrole = message.guild.roles.find(role => role.name === "Member")
let role = message.guild.roles.find(role => role.name === "Muted")

Upvotes: 4

Views: 25393

Answers (1)

Androz2091
Androz2091

Reputation: 3005

Yes, you now have to use message.guild.roles.cache.find, since v12 uses Managers. You can read the documentation to find the other changes by yourself.

Upvotes: 7

Related Questions