Every discrete feature in Moderator Toolbox is implemented as a self-contained module. Each module lives inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/toolbox-team/reddit-moderator-toolbox/llms.txt
Use this file to discover all available pages before exploring further.
extension/data/modules/ as its own file, exports a Module instance as its default export, and declares its own settings. When Toolbox loads, tbmodule.jsx collects all registered modules, checks whether each one is enabled, and calls its initializer in parallel.
File layout
The repo structure is currently in flux due to an ongoing React UI rewrite. The conventions described here remain the authoritative pattern for new modules, but not every existing file follows them exactly.
Creating a module
Import theModule class from tbmodule.jsx, construct an instance with your options and an initializer function, and export it as the default export.
Module constructor options
The first argument tonew Module() is an options object:
| Option | Type | Default | Description |
|---|---|---|---|
name | string | — | Human-readable name shown in the settings UI. |
id | string | name (whitespace stripped) | Identifier used as a prefix for storage keys. |
enabledByDefault | boolean | false | If true, the module is enabled on fresh installs. |
alwaysEnabled | boolean | false | If true, the module cannot be disabled by the user. |
debug | boolean | false | If true, the module only appears when Toolbox debug mode is on. |
oldReddit | boolean | false | Marks the module as Old Reddit-only in the settings interface. |
settings | SettingDefinition[] | [] | Array of setting definitions (see below). |
async function that runs when Toolbox loads and the module is enabled. Inside the initializer, this refers to the Module instance, so you can call this.get(id) to read settings.
Real-world example: Modbar
The following is taken directly fromextension/data/modules/modbar.js:
Setting types
Each object in thesettings array is a SettingDefinition. The required fields are id, type, and default. Optional flags (advanced, debug, hidden) control visibility in the settings UI.
boolean
A checkbox.
default should be true or false.number
A numeric input.
default should be a number.text
A single-line text input.
textarea
A multi-line text area.
selector
A dropdown. Requires a
values array of option strings.array
An editable list of strings.
code
A CodeMirror-backed code editor, suitable for custom CSS or JS snippets.
How modules are loaded
tbmodule.jsx exports a TBModule registry object. Each module file registers itself when imported. On page load, TBModule.init() iterates all registered modules, skips any that are disabled or filtered out (debug mode, Old Reddit check), and calls module.init() on the rest — all in parallel via Promise.all.
Utility references
Toolbox provides several shared utilities you can import from the core files:TBApi
Reddit API helpers — reading and writing wiki pages, fetching mod lists, and more. Imported from
../tbapi.ts.TBHelpers
General-purpose utility functions such as time formatting, string manipulation, and subreddit parsing. Imported from
../tbhelpers.js.TBui
UI building helpers for constructing Toolbox interface elements and dialogs. Imported from
../tbui.js.TBListener
DOM event system for reacting to Reddit page mutations without polling. Imported from
../tblistener.js.