moderator-toolbox-nxg-for-reddit / modules/removalreasons/automodReasons

modules/removalreasons/automodReasons

Functions

parseAutomodReasons()

parseAutomodReasons(configText): string[]

Defined in: extension/data/modules/removalreasons/automodReasons.ts:49

Extracts the distinct report reasons from a raw AutoModerator config string — the action_reason of each action: report rule — in first-seen order. Surrounding quotes are stripped; empty values and YAML block-scalar indicators (>/|, whose content spans following lines) are skipped. Dedup is case-insensitive but preserves each reason’s first-seen original text.

Parameters

configText

string

The raw config/automoderator wiki page content.

Returns

string[]


staticReasonPart()

staticReasonPart(reason): string

Defined in: extension/data/modules/removalreasons/automodReasons.ts:30

Reduces an AutoMod action_reason to a literal substring usable for matching by dropping {{placeholder}} tokens (which AutoMod substitutes at report time, so they never appear verbatim in the queue) and keeping the longest remaining static run. A reason with no placeholders is returned trimmed and unchanged.

Parameters

reason

string

The raw action_reason value, possibly containing {{...}} tokens.

Returns

string