Interface RoleManager

All Superinterfaces:
AuditableRestAction<Void>, Manager<RoleManager>, RestAction<Void>

public interface RoleManager extends Manager<RoleManager>
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:
  • Field Details

  • Method Details

    • reset

      @Nonnull @CheckReturnValue 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:

      Specified by:
      reset in interface Manager<RoleManager>
      Parameters:
      fields - Integer value containing the flags to reset.
      Returns:
      RoleManager for chaining convenience
    • reset

      @Nonnull @CheckReturnValue RoleManager reset(@Nonnull long... fields)
      Resets the fields specified by the provided bit-flag patterns.
      Example: manager.reset(RoleManager.COLOR, RoleManager.NAME);

      Flag Constants:

      Specified by:
      reset in interface Manager<RoleManager>
      Parameters:
      fields - Integer values containing the flags to reset.
      Returns:
      RoleManager for chaining convenience
    • getRole

      @Nonnull Role getRole()
      The target Role for this manager
      Returns:
      The target Role
    • getGuild

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

      @Nonnull @CheckReturnValue RoleManager setName(@Nonnull String name)
      Sets the name of the selected Role.

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

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

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

      @Nonnull @CheckReturnValue default RoleManager setPermissions(@Nonnull Permission... permissions)
      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:
      permissions - The new permission 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
      IllegalArgumentException - If any of the provided values is null
      See Also:
    • setPermissions

      @Nonnull @CheckReturnValue default RoleManager setPermissions(@Nonnull Collection<Permission> permissions)
      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:
      permissions - The new permission 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
      IllegalArgumentException - If any of the provided values is null
      See Also:
    • setColor

      @Nonnull @CheckReturnValue default RoleManager setColor(@Nullable Color color)
      Sets the Color of the selected Role.
      Parameters:
      color - The new color for the selected Role
      Returns:
      RoleManager for chaining convenience
    • setColor

      @Nonnull @CheckReturnValue 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:
    • setHoisted

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

      @Nonnull @CheckReturnValue 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
    • setIcon

      @Nonnull @CheckReturnValue RoleManager setIcon(@Nullable Icon icon)
      Sets the Icon of this Role.
      Parameters:
      icon - The new icon for this Role or null to reset
      Returns:
      RoleManager for chaining convenience
    • setIcon

      @Nonnull @CheckReturnValue RoleManager setIcon(@Nullable String emoji)
      Sets the Unicode Emoji of this Role instead of a custom image.
      Parameters:
      emoji - The new Unicode Emoji for this Role or null to reset
      Returns:
      RoleManager for chaining convenience
    • setIcon

      @Nonnull @CheckReturnValue default RoleManager setIcon(@Nullable UnicodeEmoji emoji)
      Sets the Unicode Emoji of this Role instead of a custom image.
      Parameters:
      emoji - The new Unicode Emoji for this Role or null to reset
      Returns:
      RoleManager for chaining convenience
      See Also:
    • givePermissions

      @Nonnull @CheckReturnValue default RoleManager givePermissions(@Nonnull Permission... perms)
      Adds the specified Permissions to 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 permission to give to 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:
    • givePermissions

      @Nonnull @CheckReturnValue RoleManager givePermissions(@Nonnull Collection<Permission> perms)
      Adds the specified Permissions to 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 permission to give to 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:
    • revokePermissions

      @Nonnull @CheckReturnValue default RoleManager revokePermissions(@Nonnull Permission... perms)
      Revokes the specified Permissions from the selected Role.

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

      Parameters:
      perms - The permission to give to the selected Role
      Returns:
      RoleManager for chaining convenience
      Throws:
      InsufficientPermissionException - If the currently logged in account does not have permission to revoke one of the specified permissions
      See Also:
    • revokePermissions

      @Nonnull @CheckReturnValue RoleManager revokePermissions(@Nonnull Collection<Permission> perms)
      Revokes the specified Permissions from the selected Role.

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

      Parameters:
      perms - The permission to give to the selected Role
      Returns:
      RoleManager for chaining convenience
      Throws:
      InsufficientPermissionException - If the currently logged in account does not have permission to revoke one of the specified permissions
      See Also: