How to check is an user has a role on discord

前端 未结 2 898
情深已故
情深已故 2021-01-24 09:29

I am struggling to find a way to check if an user has a role. I know how to find a certain role:

public Role findRole(Guild guild, String name) {
    List

        
2条回答
  •  北荒
    北荒 (楼主)
    2021-01-24 10:05

    Since there's no such feature in the doc yet, you can do this:

    boolean hasRole;
      for(int i=0; i

    Then, for true if (hasRole) or false if (!hasRole)

提交回复
热议问题