Skip to main content

Macros

Macros allow you to group multiple moderation actions together into a single, reusable command. This is exceptionally useful for standardizing complex moderation workflows, such as handling a rule violation by removing the post, locking it, and leaving a stickied removal reason—all in one go.

Macro Structure

A macro is defined in the macros array in your configuration. It requires a name and a list of actions.

macros:
- name: "Standard Removal Workflow"
actions:
- type: "remove_post"
reason: "Violated community guidelines."
- type: "lock_post"
- type: "submit_comment"
text: "Your post has been removed for violating our community guidelines. Please review the rules."
sticky: true

How to Trigger Macros

Macros do not listen to events themselves; they wait to be called. There are two primary ways to trigger a macro:

  1. From a Rule: You can use the run_macro action type within an automated rule.
  2. From a Custom UI Action: You can bind a macro to a UI Action. When a moderator selects it from the "🛡️ MG Actions" dropdown on a post or comment, the entire macro is executed.

Triggering via a Rule

To trigger a macro from an automated rule, simply pass the macro's name as the macro property in the rule's actions array:

macros:
- name: "Standard Removal Workflow"
actions:
- type: "remove_post"
reason: "Violated community guidelines."
- type: "lock_post"
- type: "submit_comment"
text: "Your post has been removed for violating our community guidelines. Please review the rules."
sticky: true

rules:
- name: "Auto-Remove Free Money Scams"
trigger:
event: "PostSubmit"
conditions:
- field: "post_title"
operator: "contains"
value: "free money"
actions:
- type: "run_macro"
macro: "Standard Removal Workflow"

Using macros within rules helps keep your YAML configuration DRY (Don't Repeat Yourself). Instead of defining the removal, lock, and comment actions over and over again, you can define the macro once and call it everywhere.