Find out if someone has a role

前端 未结 6 1865
萌比男神i
萌比男神i 2020-12-06 11:47

I made a simple quote bot for a server, but the admin only wants mod+ people to be able to add quotes to avoid spam. I went to the documentation and did everything, but I ca

6条回答
  •  不思量自难忘°
    2020-12-06 12:09

    I'm probably wayy to late with this, but I just had the same problem, and the way i solved it is to search for the role, and then check if the variable has anything on it. Say i wanna check for if the author of the message has admin role:

    client.on('message',message =>{
    
         adminrole = message.member.roles.cache.find(role => role.name == "Admin");
         if(adminrole != null){memberIsAdmin = true;}else{memberIsAdmin = false;}
    
    }
    

    Maybe this will help someone, note that I'm not very experienced with js tho :) Have a nice day y'all

提交回复
热议问题