Package discord4j.core.object.automod
Class AutoModRule
java.lang.Object
discord4j.core.object.automod.AutoModRule
- All Implemented Interfaces:
DiscordObject
,Entity
An Auto Moderation Rule
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Represents an Event Type of AutoMod Rule.static enum
Represents a Trigger Type of AutoMod Rule. -
Constructor Summary
ConstructorDescriptionAutoModRule
(GatewayDiscordClient gateway, discord4j.discordjson.json.AutoModRuleData data) -
Method Summary
Modifier and TypeMethodDescriptiondelete()
Requests to delete this rule.Requests to delete this rule while optionally specifying a reason.edit
(discord4j.core.spec.AutoModRuleEditSpec spec) Requests to edit this AutoMod rule.discord4j.core.spec.AutoModRuleEditMono
edit
(String name, AutoModRule.EventType eventType, boolean enabled) Requests to edit this AutoMod rule.Gets the actions which will execute when the rule is triggeredReturns theGatewayDiscordClient
that created this object.Gets theSnowflake
of the creator of the rule.Requests to retrieve theUser
who has created this rule.discord4j.discordjson.json.AutoModRuleData
getData()
getId()
Gets the Snowflake that uniquely identifies this entity.getName()
Gets the name of the ruleGets the Trigger MetaData related to this rule.Gets the type of trigger used in the rule.boolean
Gets if the rule is enabled.
-
Constructor Details
-
AutoModRule
-
-
Method Details
-
getData
public discord4j.discordjson.json.AutoModRuleData getData() -
getClient
Description copied from interface:DiscordObject
Returns theGatewayDiscordClient
that created this object. Methods in it are exclusively based on the entity cache orStore
in use. Refer to callinggetClient().rest()
to access aDiscordClient
that is capable of requesting entities directly from the REST API.- Specified by:
getClient
in interfaceDiscordObject
- Returns:
- The
GatewayDiscordClient
associated to this object.
-
getId
Description copied from interface:Entity
Gets the Snowflake that uniquely identifies this entity. -
getGuildId
-
getCreatorId
Gets theSnowflake
of the creator of the rule.- Returns:
- The
Snowflake
of the creator
-
getCreatorUser
Requests to retrieve theUser
who has created this rule. -
isEnabled
public boolean isEnabled()Gets if the rule is enabled.- Returns:
true
if this rule is enabled,false
otherwise.
-
getName
Gets the name of the rule- Returns:
- the name of the rule
-
getTriggerType
Gets the type of trigger used in the rule.- Returns:
- The type of trigger used in the rule.
-
getTriggerMetaData
Gets the Trigger MetaData related to this rule.- Returns:
- A
AutoModRuleTriggerMetaData
-
getActions
Gets the actions which will execute when the rule is triggered- Returns:
- A list of
AutoModRuleAction
-
getEventType
-
getExemptRolesIds
-
getExemptChannelsIds
-
edit
public discord4j.core.spec.AutoModRuleEditMono edit(String name, AutoModRule.EventType eventType, boolean enabled) Requests to edit this AutoMod rule. Properties specifying how to edit this rule can be set via thewithXxx
methods of the returnedAutoModRuleEditMono
.- Parameters:
name
- new name to seteventType
- type of event to setenabled
- status of the rule- Returns:
- A
AutoModRuleEditMono
where, upon successful completion, emits the editedAutoModRule
. If an error is received, it is emitted through theAutoModRuleEditMono
.
-
edit
Requests to edit this AutoMod rule.- Parameters:
spec
- an immutable object that specifies how to edit this AutoMod Rule- Returns:
- A
Mono
where, upon successful completion, emits the editedAutoModRule
. If an error is received, it is emitted through theMono
.
-
delete
Requests to delete this rule.- Returns:
- A
Mono
where, upon successful completion, emits nothing; indicating the rule has been deleted. If an error is received, it is emitted through theMono
.
-
delete
Requests to delete this rule while optionally specifying a reason.- Parameters:
reason
- The reason, if present.- Returns:
- A
Mono
where, upon successful completion, emits nothing; indicating the rule has been deleted. If an error is received, it is emitted through theMono
.
-