Class RoleAction


  • public class RoleAction
    extends AuditableRestAction<Role>
    Extension of RestAction specifically designed to create a Role. This extension allows setting properties before executing the action.
    Since:
    3.0
    • Constructor Detail

      • RoleAction

        public RoleAction​(net.dv8tion.jda.core.requests.Route.CompiledRoute route,
                          Guild guild)
        Creates a new RoleAction instance
        Parameters:
        route - A CompiledRoute Which will be used for the Role creation.
        guild - The Guild for which the Role should be created.
    • Method Detail

      • setCheck

        public RoleAction setCheck​(java.util.function.BooleanSupplier checks)
        Description copied from class: RestAction
        Sets the last-second checks before finally executing the http request in the queue.
        If the provided supplier evaluates to false or throws an exception this will not be finished. When an exception is thrown from the supplier it will be provided to the failure callback.
        Overrides:
        setCheck in class AuditableRestAction<Role>
        Parameters:
        checks - The checks to run before executing the request, or null to run no checks
        Returns:
        The current RestAction for chaining convenience
      • setName

        @CheckReturnValue
        public RoleAction setName​(java.lang.String name)
        Sets the name for new role (optional)
        Parameters:
        name - The name for the new role, null to use default name
        Returns:
        The current RoleAction, for chaining convenience
      • setHoisted

        @CheckReturnValue
        public RoleAction setHoisted​(java.lang.Boolean hoisted)
        Sets whether or not the new role should be hoisted
        Parameters:
        hoisted - Whether the new role should be hoisted (grouped). Default is false
        Returns:
        The current RoleAction, for chaining convenience
      • setMentionable

        @CheckReturnValue
        public RoleAction setMentionable​(java.lang.Boolean mentionable)
        Sets whether the new role should be mentionable by members of the parent Guild.
        Parameters:
        mentionable - Whether the new role should be mentionable. Default is false
        Returns:
        The current RoleAction, for chaining convenience
      • setColor

        @CheckReturnValue
        public RoleAction setColor​(java.awt.Color color)
        Sets the color which the new role should be displayed with.
        Parameters:
        color - An Color for the new role, null to use default white/black
        Returns:
        The current RoleAction, for chaining convenience
      • setColor

        @CheckReturnValue
        public RoleAction setColor​(java.lang.Integer rgb)
        Sets the Color for the new role. This accepts colors from the range 0x000 to 0xFFFFFF. The provided value will be ranged using rbg & 0xFFFFFF
        Parameters:
        rgb - The color for the new role in integer form, null to use default white/black
        Returns:
        The current RoleAction, for chaining convenience
      • setPermissions

        @CheckReturnValue
        public RoleAction setPermissions​(Permission... permissions)
        Sets the Permissions the new Role should have. This will only allow permissions that the current account already holds unless the account is owner or admin of the parent Guild.
        Parameters:
        permissions - The varargs Permissions for the new role
        Returns:
        The current RoleAction, for chaining convenience
        Throws:
        InsufficientPermissionException - If the currently logged in account does not hold one of the specified permissions
        java.lang.IllegalArgumentException - If any of the provided permissions is null
        See Also:
        Permission.getRaw(Permission...)
      • setPermissions

        @CheckReturnValue
        public RoleAction setPermissions​(java.util.Collection<Permission> permissions)
        Sets the Permissions the new Role should have. This will only allow permissions that the current account already holds unless the account is owner or admin of the parent Guild.
        Parameters:
        permissions - A Collection of Permissions for the new role
        Returns:
        The current RoleAction, for chaining convenience
        Throws:
        InsufficientPermissionException - If the currently logged in account does not hold one of the specified permissions
        java.lang.IllegalArgumentException - If any of the provided permissions is null
        See Also:
        Permission.getRaw(Collection), EnumSet