简体   繁体   中英

discord.js message.member.roles.find is not a function

So i was trying to make a bot in discord.js, and i wanted to make a command that displays "test sucsessfull" if you have the right roles. But when i start the but it gives me this error: message.member.roles.find is not a function.

This is the code for the command:

if(command === "test"){
    if(message.member.roles.find("name", "wardens")){
    message.channel.send("test sucsessfull")
    }else{
    message.channel.send("you do not have the right permissions for this command!")
    }

}
if(command === "test"){

  let roletest = message.guild.roles.find(r => r.name === "wardens")

  if(message.member.roles.has(roletest.id)){
    message.channel.send("Test sucsessfull")
  } else {
    message.channel.send("you do not have the right permissions for this 
    command!")
  }

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM