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:
  • Constructor Details

    • AutoModRule

      public AutoModRule(GatewayDiscordClient gateway, discord4j.discordjson.json.AutoModRuleData data)
  • Method Details

    • getData

      public discord4j.discordjson.json.AutoModRuleData getData()
    • getClient

      public GatewayDiscordClient getClient()
      Description copied from interface: DiscordObject
      Returns the GatewayDiscordClient that created this object. Methods in it are exclusively based on the entity cache or Store in use. Refer to calling getClient().rest() to access a DiscordClient that is capable of requesting entities directly from the REST API.
      Specified by:
      getClient in interface DiscordObject
      Returns:
      The GatewayDiscordClient associated to this object.
    • getId

      public Snowflake getId()
      Description copied from interface: Entity
      Gets the Snowflake that uniquely identifies this entity.
      Specified by:
      getId in interface Entity
      Returns:
      The Snowflake that uniquely identifies this entity.
    • getGuildId

      public Snowflake getGuildId()
    • getCreatorId

      public Snowflake getCreatorId()
      Gets the Snowflake of the creator of the rule.
      Returns:
      The Snowflake of the creator
    • getCreatorUser

      public Mono<User> getCreatorUser()
      Requests to retrieve the User who has created this rule.
      Returns:
      A Mono where, upon successful completion, emits the User that has started typing. If an error is received, it is emitted through the Mono.
    • 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()
    • getExemptRolesIds

      public List<Snowflake> getExemptRolesIds()
    • getExemptChannelsIds

      public List<Snowflake> 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 the withXxx methods of the returned AutoModRuleEditMono.
      Parameters:
      name - new name to set
      eventType - type of event to set
      enabled - status of the rule
      Returns:
      A AutoModRuleEditMono where, upon successful completion, emits the edited AutoModRule. If an error is received, it is emitted through the AutoModRuleEditMono.
    • 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 edited AutoModRule. If an error is received, it is emitted through the Mono.
    • 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 the Mono.
    • 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 the Mono.