EDA.AutoMod.Action (EDA v0.3.0)

Copy Markdown View Source

Represents an action taken by an Auto Moderation rule.

Action Types

ValueNameDescription
1block_messageBlock the message with optional custom response
2send_alertSend alert to a specified channel
3timeoutTimeout the user (max 4 weeks)
4block_member_interactionBlock member interactions in the guild

Helper Constructors

EDA.AutoMod.Action.block_message()
EDA.AutoMod.Action.block_message("Custom blocked message")
EDA.AutoMod.Action.send_alert("channel_id")
EDA.AutoMod.Action.timeout(60)
EDA.AutoMod.Action.block_member_interaction()

Summary

Functions

Creates a block_member_interaction action (type 4).

Creates a block_message action (type 1) with no custom message.

Creates a block_message action (type 1) with a custom response message.

Converts a raw Discord action map into this struct.

Creates a send_alert action (type 2) targeting the given channel.

Creates a timeout action (type 3) with the given duration in seconds.

Converts this struct to a map for API serialization.

Types

t()

@type t() :: %EDA.AutoMod.Action{
  metadata: EDA.AutoMod.ActionMetadata.t() | nil,
  type: integer() | nil
}

Functions

block_member_interaction()

@spec block_member_interaction() :: t()

Creates a block_member_interaction action (type 4).

block_message()

@spec block_message() :: t()

Creates a block_message action (type 1) with no custom message.

block_message(custom_message)

@spec block_message(String.t()) :: t()

Creates a block_message action (type 1) with a custom response message.

from_raw(raw)

@spec from_raw(map()) :: t()

Converts a raw Discord action map into this struct.

send_alert(channel_id)

@spec send_alert(String.t()) :: t()

Creates a send_alert action (type 2) targeting the given channel.

timeout(duration_seconds)

@spec timeout(integer()) :: t()

Creates a timeout action (type 3) with the given duration in seconds.

to_map(action)

@spec to_map(t()) :: map()

Converts this struct to a map for API serialization.