Class AutoModAction
An AutoModAction object represents a specific action to be taken in an auto moderation system. Each AutoModAction has a type, an action limit, and a set of optional parameters.
Example usage: AutoModAction action = new AutoModAction("DELETE;LIMIT=3;REASON=Spam"); AutoModActionType type = action.getType(); // returns AutoModActionType.DELETE int limit = action.getActionLimit(); // returns 3 String reason = action.getParameter(AutoModActionParameters.REASON); // returns "Spam"
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAutoModAction
(@NotNull String actionString) Constructs a new AutoModAction object by parsing the given action string. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Compares this AutoModAction instance with the specified object for equality.int
Returns the action limit for the AutoMod action.Retrieves the value of the specified AutoModActionParameters key from the parameters map.getType()
Returns the type of the AutoMod action.int
hashCode()
Calculates the hash code for the AutoModAction object.static AutoModAction @NotNull []
parseActions
(@NotNull String actionsString) Parses a string representation of auto moderation actions and returns an array of AutoModAction objects.toString()
Returns a string representation of the AutoModAction object.
-
Constructor Details
-
AutoModAction
Constructs a new AutoModAction object by parsing the given action string. The action string should be in the format "actionType!actionLimit:parameter1=value1:parameter2=value2:...".- Parameters:
actionString
- the string representation of the auto moderation action- Throws:
NullPointerException
- if the actionString is null
-
-
Method Details
-
parseActions
Parses a string representation of auto moderation actions and returns an array of AutoModAction objects.- Parameters:
actionsString
- the string representation of the auto moderation actions- Returns:
- the array of AutoModAction objects parsed from the actionsString
-
toString
Returns a string representation of the AutoModAction object.The string has the format "AutoModAction{type=TYPE, actionLimit=ACTION_LIMIT, parameters=[PARAMS]}". The parameters are represented as a comma-separated list of key-value pairs enclosed in curly braces, where each pair is represented as "key=KEY, value=VALUE".
-
equals
Compares this AutoModAction instance with the specified object for equality. Returns true if and only if the specified object is also an AutoModAction instance, all the corresponding instance variables have the same values in both objects. -
hashCode
public int hashCode()Calculates the hash code for the AutoModAction object. -
getType
Returns the type of the AutoMod action.- Returns:
- the AutoModActionType representing the type of the action
-
getActionLimit
public int getActionLimit()Returns the action limit for the AutoMod action.- Returns:
- the action limit
-
getParameter
Retrieves the value of the specified AutoModActionParameters key from the parameters map.- Parameters:
key
- the AutoModActionParameters key- Returns:
- the value associated with the specified key, or null if the key is not found in the map
-