Find out if someone has a role

前端 未结 6 1863
萌比男神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:23

    message.member.roles is a collection. Instead of getting the roles object, then looking for it, just look for the role directly in the collection. Try this:

    else if (command === "addquote" && arg) {
        if(message.member.roles.find(r => r.name === "Admin") || message.member.roles.find(r => rname === "Mod")){
            //Rest of your code
        }
    

    Note, the role name must be the name you put in the find including any emojis if there's any in the role name.

提交回复
热议问题