Class RoleManager


  • public class RoleManager
    extends net.dv8tion.jda.core.managers.impl.ManagerBase
    Manager providing functionality to update one or more fields for a Role.

    Example

    
     manager.setName("Administrator")
            .setColor(null)
            .queue();
     manager.reset(RoleManager.PERMISSION | RoleManager.NAME)
            .setName("Traitor")
            .setColor(Color.RED)
            .queue();
     
    See Also:
    Role.getManager()
    • Constructor Detail

      • RoleManager

        public RoleManager​(Role role)
        Creates a new RoleManager instance
        Parameters:
        role - Role that should be modified
    • Method Detail

      • getGuild

        public Guild getGuild()
        The Guild this Manager's Role is in.
        This is logically the same as calling getRole().getGuild()
        Returns:
        The parent Guild
      • getRole

        public Role getRole()
        The target Role for this manager
        Returns:
        The target Role
      • reset

        @CheckReturnValue
        public RoleManager reset​(long fields)
        Resets the fields specified by the provided bit-flag pattern. You can specify a combination by using a bitwise OR concat of the flag constants.
        Example: manager.reset(RoleManager.COLOR | RoleManager.NAME);

        Flag Constants:

        Overrides:
        reset in class net.dv8tion.jda.core.managers.impl.ManagerBase
        Parameters:
        fields - Integer value containing the flags to reset.
        Returns:
        RoleManager for chaining convenience
      • reset

        @CheckReturnValue
        public RoleManager reset​(long... fields)
        Resets the fields specified by the provided bit-flag patterns. You can specify a combination by using a bitwise OR concat of the flag constants.
        Example: manager.reset(RoleManager.COLOR, RoleManager.NAME);

        Flag Constants:

        Overrides:
        reset in class net.dv8tion.jda.core.managers.impl.ManagerBase
        Parameters:
        fields - Integer values containing the flags to reset.
        Returns:
        RoleManager for chaining convenience
      • reset

        @CheckReturnValue
        public RoleManager reset()
        Resets all fields for this manager.
        Returns:
        RoleManager for chaining convenience
      • setName

        @CheckReturnValue
        public RoleManager setName​(java.lang.String name)
        Sets the name of the selected Role.

        A role name must not be null nor less than 1 characters or more than 32 characters long!

        Parameters:
        name - The new name for the selected Role
        Returns:
        RoleManager for chaining convenience
        Throws:
        java.lang.IllegalArgumentException - If the provided name is null or not between 1-32 characters long
      • setPermissions

        @CheckReturnValue
        public RoleManager setPermissions​(long perms)
        Sets the Permissions of the selected Role.

        Permissions may only include already present Permissions for the currently logged in account.
        You are unable to give permissions you don't have!

        Parameters:
        perms - The new raw permission value for the selected Role
        Returns:
        RoleManager for chaining convenience
        Throws:
        InsufficientPermissionException - If the currently logged in account does not have permission to apply one of the specified permissions
        See Also:
        setPermissions(Collection), setPermissions(Permission...)
      • setColor

        @CheckReturnValue
        public RoleManager setColor​(java.awt.Color color)
        Sets the Color of the selected Role.
        Parameters:
        color - The new color for the selected Role
        Returns:
        RoleManager for chaining convenience
      • setColor

        @CheckReturnValue
        public RoleManager setColor​(int rgb)
        Sets the rgb color of the selected Role.
        Parameters:
        rgb - The new color for the selected Role
        Returns:
        RoleManager for chaining convenience
        See Also:
        Role.DEFAULT_COLOR_RAW
      • setHoisted

        @CheckReturnValue
        public RoleManager setHoisted​(boolean hoisted)
        Sets the hoist state of the selected Role.
        Parameters:
        hoisted - Whether the selected Role should be hoisted
        Returns:
        RoleManager for chaining convenience
      • setMentionable

        @CheckReturnValue
        public RoleManager setMentionable​(boolean mentionable)
        Sets the mentionable state of the selected Role.
        Parameters:
        mentionable - Whether the selected Role should be mentionable
        Returns:
        RoleManager for chaining convenience