Package discord4j.core.object.automod
Class AutoModRule
- java.lang.Object
-
- discord4j.core.object.automod.AutoModRule
-
- All Implemented Interfaces:
DiscordObject
,Entity
public class AutoModRule extends Object implements Entity
An Auto Moderation Rule- See Also:
- Auto Moderation Rule
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AutoModRule.EventType
Represents an Event Type of AutoMod Rule.static class
AutoModRule.TriggerType
Represents a Trigger Type of AutoMod Rule.
-
Constructor Summary
Constructors Constructor Description AutoModRule(GatewayDiscordClient gateway, discord4j.discordjson.json.AutoModRuleData data)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Mono<Void>
delete()
Requests to delete this rule.Mono<Void>
delete(String reason)
Requests to delete this rule while optionally specifying a reason.Mono<AutoModRule>
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.List<AutoModRuleAction>
getActions()
Gets the actions which will execute when the rule is triggeredGatewayDiscordClient
getClient()
Returns theGatewayDiscordClient
that created this object.Snowflake
getCreatorId()
Gets theSnowflake
of the creator of the rule.Mono<User>
getCreatorUser()
Requests to retrieve theUser
who has created this rule.discord4j.discordjson.json.AutoModRuleData
getData()
AutoModRule.EventType
getEventType()
List<Snowflake>
getExemptChannelsIds()
List<Snowflake>
getExemptRolesIds()
Snowflake
getGuildId()
Snowflake
getId()
Gets the Snowflake that uniquely identifies this entity.String
getName()
Gets the name of the ruleAutoModRuleTriggerMetaData
getTriggerMetaData()
Gets the Trigger MetaData related to this rule.AutoModRule.TriggerType
getTriggerType()
Gets the type of trigger used in the rule.boolean
isEnabled()
Gets if the rule is enabled.
-
-
-
Constructor Detail
-
AutoModRule
public AutoModRule(GatewayDiscordClient gateway, discord4j.discordjson.json.AutoModRuleData data)
-
-
Method Detail
-
getData
public discord4j.discordjson.json.AutoModRuleData getData()
-
getClient
public GatewayDiscordClient 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
public Snowflake getId()
Description copied from interface:Entity
Gets the Snowflake that uniquely identifies this entity.
-
getGuildId
public Snowflake getGuildId()
-
getCreatorId
public Snowflake getCreatorId()
Gets theSnowflake
of the creator of the rule.- Returns:
- The
Snowflake
of the creator
-
getCreatorUser
public Mono<User> 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
public String getName()
Gets the name of the rule- Returns:
- the name of the rule
-
getTriggerType
public AutoModRule.TriggerType getTriggerType()
Gets the type of trigger used in the rule.- Returns:
- The type of trigger used in the rule.
-
getTriggerMetaData
public AutoModRuleTriggerMetaData getTriggerMetaData()
Gets the Trigger MetaData related to this rule.- Returns:
- A
AutoModRuleTriggerMetaData
-
getActions
public List<AutoModRuleAction> getActions()
Gets the actions which will execute when the rule is triggered- Returns:
- A list of
AutoModRuleAction
-
getEventType
public AutoModRule.EventType getEventType()
-
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
public Mono<AutoModRule> edit(discord4j.core.spec.AutoModRuleEditSpec spec)
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
public Mono<Void> 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
public Mono<Void> delete(@Nullable String reason)
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
.
-
-