moderator-toolbox-nxg-for-reddit / modules/macros/moduleapi

modules/macros/moduleapi

Functions

getMacroConfig()

getMacroConfig(subreddit): Promise<MacroConfig[] | undefined>

Defined in: extension/data/modules/macros/moduleapi.ts:12

Retrieves the macro list for the given subreddit from its toolbox wiki config.

Parameters

subreddit

string

The subreddit name (without the r/ prefix).

Returns

Promise<MacroConfig[] | undefined>

The array of macro configs, or undefined if no macros are configured.


reloadToolboxConfig()

reloadToolboxConfig(subreddit): Promise<ToolboxConfig | null>

Defined in: extension/data/modules/macros/moduleapi.ts:26

Reads and purifies the freshest toolbox config from the subreddit wiki. Used by the macro settings tabs to refresh their list after an external wiki edit.

Parameters

subreddit

string

The subreddit name (without the r/ prefix).

Returns

Promise<ToolboxConfig | null>

The normalized config object, or null if the wiki read failed.


saveMacroConfig()

saveMacroConfig(subreddit, config, note): void

Defined in: extension/data/modules/macros/moduleapi.ts:36

Persists the full toolbox config (including updated mod macros) to the subreddit wiki.

Parameters

subreddit

string

The subreddit name (without the r/ prefix).

config

ToolboxConfig

The full toolbox config object to write.

note

string

The wiki revision note.

Returns

void