Interface Role

    • Field Detail

      • DEFAULT_COLOR_RAW

        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.
        Returns:
        The position of this Role as integer.
        Throws:
        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.
        Returns:
        The true, Discord stored, position of the Role.
      • getName

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

        boolean isManaged()
        Whether this Role is managed by an integration
        Returns:
        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
        Returns:
        True, if this Role is hoisted.
      • isMentionable

        boolean isMentionable()
        Whether or not this Role is mentionable
        Returns:
        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.
        Returns:
        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
        Returns:
        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.
        Returns:
        True, if and only if this Role is the public role for the Guild provided by getGuild().
        See Also:
        Guild.getPublicRole()
      • canInteract

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

        @Nonnull
        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.

        Returns:
        The RoleManager of this Role
        Throws:
        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

        @Nonnull
        JDA getJDA()
        Returns the JDA instance of this Role
        Returns:
        the corresponding JDA instance