Interface AutoModRuleManager

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

public interface AutoModRuleManager extends Manager<AutoModRuleManager>
Manager providing functionality to update one or more fields for an AutoModRule.

Example

manager.setName("Discord Invites")
       .setEnables(false)
       .queue();
manager.reset(AutoModRuleManager.NAME | AutoModRuleManager.ENABLED)
       .setName("Invites")
       .setEnabled(true)
       .queue();
See Also:
  • Field Details

    • NAME

      static final long NAME
      Used to reset the name field.
      See Also:
    • ENABLED

      static final long ENABLED
      Used to reset the enabled field.
      See Also:
    • RESPONSE

      static final long RESPONSE
      Used to reset the response field.
      See Also:
    • EXEMPT_ROLES

      static final long EXEMPT_ROLES
      Used to reset the exempt roles field.
      See Also:
    • EXEMPT_CHANNELS

      static final long EXEMPT_CHANNELS
      Used to reset the exempt channels field.
      See Also:
    • TRIGGER_METADATA

      static final long TRIGGER_METADATA
      Used to reset the trigger metadata field.
      See Also:
  • Method Details

    • reset

      @Nonnull @CheckReturnValue AutoModRuleManager 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(AutoModRuleManager.NAME | AutoModRuleManager.RESPONSE);

      Flag Constants:

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

      @Nonnull @CheckReturnValue AutoModRuleManager reset(@Nonnull 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(AutoModRuleManager.NAME, AutoModRuleManager.RESPONSE);

      Flag Constants:

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

      @Nonnull @CheckReturnValue AutoModRuleManager setName(@Nonnull String name)
      Sets the name of the selected AutoModRule.

      A rule name must be between 1-100 characters long!

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

      @Nonnull @CheckReturnValue AutoModRuleManager setEnabled(boolean enabled)
      Sets the enabled state of the selected AutoModRule.

      When a rule is disabled, it will not be applied to any messages.

      Parameters:
      enabled - True, if the selected AutoModRule should be enabled
      Returns:
      AutoModRuleManager for chaining convenience
    • setResponses

      @Nonnull @CheckReturnValue AutoModRuleManager setResponses(@Nonnull Collection<? extends AutoModResponse> responses)
      Sets what the rule should do upon triggering.

      Note that each response type can only be used once. If multiple responses of the same type are provided, the last one is used.

      Parameters:
      responses - The responses to configure
      Returns:
      AutoModRuleManager for chaining convenience
      Throws:
      IllegalArgumentException -
    • setResponses

      @Nonnull @CheckReturnValue default AutoModRuleManager setResponses(@Nonnull AutoModResponse... responses)
      Sets what the rule should do upon triggering.

      Note that each response type can only be used once. If multiple responses of the same type are provided, the last one is used.

      Parameters:
      responses - The responses to configure
      Returns:
      AutoModRuleManager for chaining convenience
      Throws:
      IllegalArgumentException -
    • setExemptRoles

      @Nonnull @CheckReturnValue AutoModRuleManager setExemptRoles(@Nonnull Collection<Role> roles)
      Set which roles can bypass this rule.

      Roles added to the exemptions will allow all of its members to bypass this rule.

      Parameters:
      roles - The roles to exempt (up to 20 roles)
      Returns:
      AutoModRuleManager for chaining convenience
      Throws:
      IllegalArgumentException - If null is provided or the number of roles exceeds 20
    • setExemptRoles

      @Nonnull @CheckReturnValue default AutoModRuleManager setExemptRoles(@Nonnull Role... roles)
      Set which roles can bypass this rule.

      Roles added to the exemptions will allow all of its members to bypass this rule.

      Parameters:
      roles - The roles to exempt (up to 20 roles)
      Returns:
      AutoModRuleManager for chaining convenience
      Throws:
      IllegalArgumentException - If null is provided or the number of roles exceeds 20
    • setExemptChannels

      @Nonnull @CheckReturnValue AutoModRuleManager setExemptChannels(@Nonnull Collection<? extends GuildChannel> channels)
      Set which channels can bypass this rule.

      No messages sent in this channel will trigger the rule.

      Parameters:
      channels - The channels to add (up to 50 channels)
      Returns:
      AutoModRuleManager for chaining convenience
      Throws:
      IllegalArgumentException - If null is provided or the number of channels exceeds 50
    • setExemptChannels

      @Nonnull @CheckReturnValue default AutoModRuleManager setExemptChannels(@Nonnull GuildChannel... channels)
      Set which channels can bypass this rule.

      No messages sent in this channel will trigger the rule.

      Parameters:
      channels - The channels to add (up to 50 channels)
      Returns:
      AutoModRuleManager for chaining convenience
      Throws:
      IllegalArgumentException - If null is provided or the number of channels exceeds 50
    • setTriggerConfig

      @Nonnull @CheckReturnValue AutoModRuleManager setTriggerConfig(@Nonnull TriggerConfig config)
      Change the TriggerConfig for this rule.
      Parameters:
      config - The new config
      Returns:
      AutoModRuleManager for chaining convenience
      Throws:
      IllegalArgumentException - If null is provided