Package net.dv8tion.jda.api.managers
Interface AutoModRuleManager
- All Superinterfaces:
AuditableRestAction<Void>
,Manager<AutoModRuleManager>
,RestAction<Void>
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 Summary
Modifier and TypeFieldDescriptionstatic final long
Used to reset the enabled field.static final long
Used to reset the exempt channels field.static final long
Used to reset the exempt roles field.static final long
Used to reset the name field.static final long
Used to reset the response field.static final long
Used to reset the trigger metadata field.Fields inherited from interface net.dv8tion.jda.api.requests.restaction.AuditableRestAction
MAX_REASON_LENGTH
-
Method Summary
Modifier and TypeMethodDescriptionreset
(long fields) Resets the fields specified by the provided bit-flag pattern.reset
(long... fields) Resets the fields specified by the provided bit-flag pattern.setEnabled
(boolean enabled) Sets the enabled state of the selectedAutoModRule
.setExemptChannels
(Collection<? extends GuildChannel> channels) Set which channels can bypass this rule.default AutoModRuleManager
setExemptChannels
(GuildChannel... channels) Set which channels can bypass this rule.setExemptRoles
(Collection<Role> roles) Set which roles can bypass this rule.default AutoModRuleManager
setExemptRoles
(Role... roles) Set which roles can bypass this rule.Sets the name of the selectedAutoModRule
.setResponses
(Collection<? extends AutoModResponse> responses) Sets what the rule should do upon triggering.default AutoModRuleManager
setResponses
(AutoModResponse... responses) Sets what the rule should do upon triggering.setTriggerConfig
(TriggerConfig config) Change theTriggerConfig
for this rule.Methods inherited from interface net.dv8tion.jda.api.requests.restaction.AuditableRestAction
reason
Methods inherited from interface net.dv8tion.jda.api.managers.Manager
deadline, reset, setCheck, timeout
Methods inherited from interface net.dv8tion.jda.api.requests.RestAction
addCheck, and, and, complete, complete, completeAfter, delay, delay, delay, delay, flatMap, flatMap, getCheck, getJDA, map, mapToResult, onErrorFlatMap, onErrorFlatMap, onErrorMap, onErrorMap, onSuccess, queue, queue, queue, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, submit, submit, submitAfter, submitAfter, zip
-
Field Details
-
NAME
static final long NAMEUsed to reset the name field.- See Also:
-
ENABLED
static final long ENABLEDUsed to reset the enabled field.- See Also:
-
RESPONSE
static final long RESPONSEUsed to reset the response field.- See Also:
-
EXEMPT_ROLES
static final long EXEMPT_ROLESUsed to reset the exempt roles field.- See Also:
-
EXEMPT_CHANNELS
static final long EXEMPT_CHANNELSUsed to reset the exempt channels field.- See Also:
-
TRIGGER_METADATA
static final long TRIGGER_METADATAUsed to reset the trigger metadata field.- See Also:
-
-
Method Details
-
reset
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 interfaceManager<AutoModRuleManager>
- Parameters:
fields
- Integer value containing the flags to reset.- Returns:
- AutoModRuleManager for chaining convenience
-
reset
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 interfaceManager<AutoModRuleManager>
- Parameters:
fields
- Integer value containing the flags to reset.- Returns:
- AutoModRuleManager for chaining convenience
-
setName
Sets the name of the selectedAutoModRule
.A rule name must be between 1-100 characters long!
- Parameters:
name
- The new name for the selectedAutoModRule
- Returns:
- AutoModRuleManager for chaining convenience
- Throws:
IllegalArgumentException
- If the provided name isnull
or not between 1-100 characters long
-
setEnabled
Sets the enabled state of the selectedAutoModRule
.When a rule is disabled, it will not be applied to any messages.
- Parameters:
enabled
- True, if the selectedAutoModRule
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
-- If
null
orAutoModResponse.Type.UNKNOWN
is provided - If the collection is empty
- If
-
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
-- If
null
orAutoModResponse.Type.UNKNOWN
is provided - If the collection is empty
- If
-
setExemptRoles
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
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
Change theTriggerConfig
for this rule.- Parameters:
config
- The new config- Returns:
- AutoModRuleManager for chaining convenience
- Throws:
IllegalArgumentException
- If null is provided
-