Improved inline contributor guides

Improved the inline contributor guides for registering new languages, config variables & commands.
This commit is contained in:
DJj123dj
2025-06-16 20:11:00 +02:00
parent 51c4ae0229
commit 160f89c7cf
9 changed files with 155 additions and 54 deletions
+20 -10
View File
@@ -1,19 +1,29 @@
import {opendiscord, api, utilities} from "../../index"
import * as fjs from "formatted-json-stringify"
/** (CONTRIBUTOR GUIDE) HOW TO ADD NEW CONFIG VARIABLES?
* - Make the change to the config file in (./config/) and be aware of the following things:
* - The variable has a clear name and its function is obvious.
* - The variable is in the correct position/category of the config.
* - The variable contains a default placeholder to suggest the contents.
* - If there's a (./devconfig/), also modify this file.
* - Register the config in loadAllConfigs() in (./src/data/framework/configLoader.ts)
* - The variable should be added to the "formatters" in the correct position.
* - Add autocomplete for the variable in ODJsonConfig_Default... in (./src/core/api/defaults/config.ts)
* - Add the variable to the config checker in (./src/data/framework/checkerLoader.ts)
* - Make sure the variable is compatible with the Interactive Setup CLI.
* - The variable should be added by the migration manager (./src/core/startup/migration.ts) when missing.
* - Update the Open Ticket Documentation.
*
* IF VARIABLE IS FROM questions.json, options.json OR panels.json:
* - Check (./src/data/openticket/...) for loading/unloading of data.
* - Check (./src/actions/createTicket.ts) and related files.
* - Check (./src/builders), (./src/actions), (./src/data) & (./src/commands) in general in the areas that were changed.
*/
export const loadAllConfigs = async () => {
const devconfigFlag = opendiscord.flags.get("opendiscord:dev-config")
const isDevconfig = devconfigFlag ? devconfigFlag.value : false
/** How to add more config variables?
* - Add the variable to the config files in `./config/` & `./devconfig/`.
* - Add the variable to the config in ./src/core/api/defaults/config.ts (interfaces + types)
* - Add the variable to the config checker in ./src/data/framework/checkerLoader.ts
* - Make sure it's compatible with the Interactive Setup CLI.
* - Make sure the Migration Manager automatically adds the variable when missing.
* - Add the variable to the formatters in this file.
* - Update the documentation reference.
*/
opendiscord.configs.add(new api.ODJsonConfig("opendiscord:general","general.json",(isDevconfig) ? "./devconfig/" : "./config/",defaultGeneralFormatter))
opendiscord.configs.add(new api.ODJsonConfig("opendiscord:questions","questions.json",(isDevconfig) ? "./devconfig/" : "./config/",defaultQuestionsFormatter))