Interface Role

    • Field Detail


        static final int DEFAULT_COLOR_RAW
        Used to keep consistency between color values used in the API
        See Also:
        Constant Field Values
    • Method Detail

      • getPosition

        int getPosition()
        The hierarchical position of this Role in the Guild hierarchy. (higher value means higher role).
        The Guild.getPublicRole()'s getPosition() always returns -1.
        The position of this Role as integer.
        IllegalStateException - If this role is not in the guild cache
      • getPositionRaw

        int getPositionRaw()
        The actual position of the Role as stored and given by Discord.
        Role positions are actually based on a pairing of the creation time (as stored in the snowflake id) and the position. If 2 or more roles share the same position then they are sorted based on their creation date.
        The more recent a role was created, the lower it is in the hierarchy. This is handled by getPosition() and it is most likely the method you want. If, for some reason, you want the actual position of the Role then this method will give you that value.
        The true, Discord stored, position of the Role.
      • getName

        String getName()
        The Name of this Role.
        Never-null String containing the name of this Role.
      • isManaged

        boolean isManaged()
        Whether this Role is managed by an integration
        True, if this Role is managed.
      • isHoisted

        boolean isHoisted()
        Whether this Role is hoisted
        Members in a hoisted role are displayed in their own grouping on the user-list
        True, if this Role is hoisted.
      • isMentionable

        boolean isMentionable()
        Whether or not this Role is mentionable
        True, if Role is mentionable.
      • getPermissionsRaw

        long getPermissionsRaw()
        The long representation of the literal permissions that this Role has.
        NOTE: these do not necessarily represent the permissions this role will have in a GuildChannel.
        Never-negative long containing offset permissions of this role.
      • getColorRaw

        int getColorRaw()
        The raw color RGB value used for this role
        Defaults to DEFAULT_COLOR_RAW if this role has no set color
        The raw RGB color value or default
      • isPublicRole

        boolean isPublicRole()
        Whether this role is the @everyone role for its Guild, which is assigned to everyone who joins the Guild.
        True, if and only if this Role is the public role for the Guild provided by getGuild().
        See Also:
      • canInteract

        boolean canInteract​(@Nonnull
                            Role role)
        Whether this Role can interact with the specified Role. (move/manage/etc.)
        role - The not-null role to compare to
        True, if this role can interact with the specified role
        IllegalArgumentException - if the provided Role is null or not from the same Guild
      • getManager

        RoleManager getManager()
        The RoleManager for this Role. In the RoleManager, you can modify all its values.
        You modify multiple fields in one request by chaining setters before calling RestAction.queue().

        This is a lazy idempotent getter. The manager is retained after the first call. This getter is not thread-safe and would require guards by the user.

        The RoleManager of this Role
        InsufficientPermissionException - If the currently logged in account does not have Permission.MANAGE_ROLES
        HierarchyException - If the currently logged in account does not have the required position to modify this role
      • getJDA

        JDA getJDA()
        Returns the JDA instance of this Role
        the corresponding JDA instance
      • getIcon

        RoleIcon getIcon()
        The Icon of this role or null if no custom image or emoji is set. This icon will be displayed next to the role's name in the members tab and in chat.
        Possibly-null Icon of this role