Improved inline contributor guides
Improved the inline contributor guides for registering new languages, config variables & commands.
This commit is contained in:
@@ -4,6 +4,16 @@
|
||||
import { ODValidId } from "../modules/base"
|
||||
import { ODClientManager, ODSlashCommand, ODTextCommand, ODSlashCommandManager, ODTextCommandManager, ODSlashCommandInteractionCallback, ODTextCommandInteractionCallback } from "../modules/client"
|
||||
|
||||
/** (CONTRIBUTOR GUIDE) HOW TO ADD NEW COMMANDS?
|
||||
* - Register the command in loadAllSlashCommands() & loadAllTextCommands() in (./src/data/framework/commandLoader.ts)
|
||||
* - Add autocomplete for the command in OD(Slash/Text)CommandManagerIds_Default in (./src/core/api/defaults/client.ts)
|
||||
* - Add the command to the help menu in (./src/data/framework/helpMenuLoader.ts)
|
||||
* - If required, new config variables should be added (incl. logs, dm-logs & permissions).
|
||||
* - Update the Open Ticket Documentation.
|
||||
* - If the command contains complex logic or can be executed from a button/dropdown, it should be placed inside an `ODAction`.
|
||||
* - Check all files, test the bot carefully & try a lot of different scenario's with different settings.
|
||||
*/
|
||||
|
||||
/**## ODClientManager_Default `default_class`
|
||||
* This is a special class that adds type definitions & typescript to the ODClientManager class.
|
||||
* It doesn't add any extra features!
|
||||
|
||||
@@ -7,6 +7,26 @@ import { ODConfigManager, ODConfig, ODJsonConfig } from "../modules/config"
|
||||
import { ODClientActivityStatus, ODClientActivityType } from "../modules/client"
|
||||
import { ODRoleUpdateMode } from "../openticket/role"
|
||||
|
||||
/** (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.
|
||||
*/
|
||||
|
||||
/**## ODConfigManagerIds_Default `interface`
|
||||
* This interface is a list of ids available in the `ODConfigManager_Default` class.
|
||||
* It's used to generate typescript declarations for this class.
|
||||
|
||||
@@ -4,6 +4,16 @@
|
||||
import { ODValidId } from "../modules/base"
|
||||
import { ODHelpMenuCategory, ODHelpMenuCommandComponent, ODHelpMenuComponent, ODHelpMenuManager } from "../modules/helpmenu"
|
||||
|
||||
/** (CONTRIBUTOR GUIDE) HOW TO ADD NEW COMMANDS?
|
||||
* - Register the command in loadAllSlashCommands() & loadAllTextCommands() in (./src/data/framework/commandLoader.ts)
|
||||
* - Add autocomplete for the command in OD(Slash/Text)CommandManagerIds_Default in (./src/core/api/defaults/client.ts)
|
||||
* - Add the command to the help menu in (./src/data/framework/helpMenuLoader.ts)
|
||||
* - If required, new config variables should be added (incl. logs, dm-logs & permissions).
|
||||
* - Update the Open Ticket Documentation.
|
||||
* - If the command contains complex logic or can be executed from a button/dropdown, it should be placed inside an `ODAction`.
|
||||
* - Check all files, test the bot carefully & try a lot of different scenario's with different settings.
|
||||
*/
|
||||
|
||||
/**## ODHelpMenuManagerIds_Default `interface`
|
||||
* This interface is a list of ids available in the `ODHelpMenuManager_Default` class.
|
||||
* It's used to generate typescript declarations for this class.
|
||||
|
||||
@@ -4,6 +4,52 @@
|
||||
import { ODValidId } from "../modules/base"
|
||||
import { ODLanguageManager, ODLanguage } from "../modules/language"
|
||||
|
||||
/** (CONTRIBUTOR GUIDE) HOW TO ADD NEW LANGUAGES?
|
||||
* - Add the file to (./languages/) and make sure the metadata is valid.
|
||||
* - Register the language in loadAllLanguages() in (./src/data/framework/languageLoader.ts).
|
||||
* - Add autocomplete for the language in ODLanguageManagerIds_Default in (./src/core/api/defaults/language.ts).
|
||||
* - Update the language list in the README.md translator list.
|
||||
* - Update the 2 language counters in the README.md features list.
|
||||
* - Update the Open Ticket Documentation.
|
||||
*/
|
||||
|
||||
/**## ODLanguageManagerIds_Default `interface`
|
||||
* This interface is a list of ids available in the `ODLanguageManager_Default` class.
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODLanguageManagerIds_Default {
|
||||
"opendiscord:custom":ODLanguage,
|
||||
"opendiscord:english":ODLanguage,
|
||||
"opendiscord:dutch":ODLanguage,
|
||||
"opendiscord:portuguese":ODLanguage,
|
||||
"opendiscord:czech":ODLanguage,
|
||||
"opendiscord:german":ODLanguage,
|
||||
"opendiscord:catalan":ODLanguage,
|
||||
"opendiscord:hungarian":ODLanguage,
|
||||
"opendiscord:spanish":ODLanguage,
|
||||
"opendiscord:romanian":ODLanguage,
|
||||
"opendiscord:ukrainian":ODLanguage,
|
||||
"opendiscord:indonesian":ODLanguage,
|
||||
"opendiscord:italian":ODLanguage,
|
||||
"opendiscord:estonian":ODLanguage,
|
||||
"opendiscord:finnish":ODLanguage,
|
||||
"opendiscord:danish":ODLanguage,
|
||||
"opendiscord:thai":ODLanguage,
|
||||
"opendiscord:turkish":ODLanguage,
|
||||
"opendiscord:french":ODLanguage,
|
||||
"opendiscord:arabic":ODLanguage,
|
||||
"opendiscord:hindi":ODLanguage,
|
||||
"opendiscord:lithuanian":ODLanguage,
|
||||
"opendiscord:polish":ODLanguage,
|
||||
"opendiscord:latvian":ODLanguage,
|
||||
"opendiscord:norwegian":ODLanguage,
|
||||
"opendiscord:russian":ODLanguage,
|
||||
"opendiscord:swedish":ODLanguage,
|
||||
"opendiscord:vietnamese":ODLanguage,
|
||||
"opendiscord:persian":ODLanguage,
|
||||
//ADD NEW LANGUAGES HERE!!!
|
||||
}
|
||||
|
||||
/**## ODLanguageManagerTranslations_Default `type`
|
||||
* This interface is a list of ids available in the `ODLanguageManager_Default` class.
|
||||
* It's used to generate typescript declarations for this class.
|
||||
@@ -439,43 +485,6 @@ export type ODLanguageManagerTranslations_Default = (
|
||||
"stats.properties.transcriptsCreated"
|
||||
)
|
||||
|
||||
/**## ODLanguageManagerIds_Default `interface`
|
||||
* This interface is a list of ids available in the `ODLanguageManager_Default` class.
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODLanguageManagerIds_Default {
|
||||
"opendiscord:custom":ODLanguage,
|
||||
"opendiscord:english":ODLanguage,
|
||||
"opendiscord:dutch":ODLanguage,
|
||||
"opendiscord:portuguese":ODLanguage,
|
||||
"opendiscord:czech":ODLanguage,
|
||||
"opendiscord:german":ODLanguage,
|
||||
"opendiscord:catalan":ODLanguage,
|
||||
"opendiscord:hungarian":ODLanguage,
|
||||
"opendiscord:spanish":ODLanguage,
|
||||
"opendiscord:romanian":ODLanguage,
|
||||
"opendiscord:ukrainian":ODLanguage,
|
||||
"opendiscord:indonesian":ODLanguage,
|
||||
"opendiscord:italian":ODLanguage,
|
||||
"opendiscord:estonian":ODLanguage,
|
||||
"opendiscord:finnish":ODLanguage,
|
||||
"opendiscord:danish":ODLanguage,
|
||||
"opendiscord:thai":ODLanguage,
|
||||
"opendiscord:turkish":ODLanguage,
|
||||
"opendiscord:french":ODLanguage,
|
||||
"opendiscord:arabic":ODLanguage,
|
||||
"opendiscord:hindi":ODLanguage,
|
||||
"opendiscord:lithuanian":ODLanguage,
|
||||
"opendiscord:polish":ODLanguage,
|
||||
"opendiscord:latvian":ODLanguage,
|
||||
"opendiscord:norwegian":ODLanguage,
|
||||
"opendiscord:russian":ODLanguage,
|
||||
"opendiscord:swedish":ODLanguage,
|
||||
"opendiscord:vietnamese":ODLanguage,
|
||||
"opendiscord:persian":ODLanguage,
|
||||
//ADD NEW LANGUAGES HERE!!!
|
||||
}
|
||||
|
||||
/**## ODLanguageManager_Default `default_class`
|
||||
* This is a special class that adds type definitions & typescript to the ODLanguageManager class.
|
||||
* It doesn't add any extra features!
|
||||
|
||||
@@ -2,6 +2,26 @@ import {opendiscord, api, utilities} from "../../index"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
|
||||
/** (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 loadAllConfigCheckers = async () => {
|
||||
opendiscord.checkers.add(new api.ODChecker("opendiscord:general",opendiscord.checkers.storage,0,opendiscord.configs.get("opendiscord:general"),defaultGeneralStructure,{cliDisplayName:"General Config",cliDisplayDescription:"Configure the bot token, status, colors, permissions & more."}))
|
||||
opendiscord.checkers.add(new api.ODChecker("opendiscord:questions",opendiscord.checkers.storage,2,opendiscord.configs.get("opendiscord:questions"),defaultQuestionsStructure,{cliDisplayName:"Questions Config",cliDisplayDescription:"Create, modify & delete questions which are used in options."}))
|
||||
|
||||
@@ -3,6 +3,16 @@ import * as discord from "discord.js"
|
||||
|
||||
const lang = opendiscord.languages
|
||||
|
||||
/** (CONTRIBUTOR GUIDE) HOW TO ADD NEW COMMANDS?
|
||||
* - Register the command in loadAllSlashCommands() & loadAllTextCommands() in (./src/data/framework/commandLoader.ts)
|
||||
* - Add autocomplete for the command in OD(Slash/Text)CommandManagerIds_Default in (./src/core/api/defaults/client.ts)
|
||||
* - Add the command to the help menu in (./src/data/framework/helpMenuLoader.ts)
|
||||
* - If required, new config variables should be added (incl. logs, dm-logs & permissions).
|
||||
* - Update the Open Ticket Documentation.
|
||||
* - If the command contains complex logic or can be executed from a button/dropdown, it should be placed inside an `ODAction`.
|
||||
* - Check all files, test the bot carefully & try a lot of different scenario's with different settings.
|
||||
*/
|
||||
|
||||
export const loadAllSlashCommands = async () => {
|
||||
const commands = opendiscord.client.slashCommands
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -2,6 +2,16 @@ import {opendiscord, api, utilities} from "../../index"
|
||||
|
||||
const lang = opendiscord.languages
|
||||
|
||||
/** (CONTRIBUTOR GUIDE) HOW TO ADD NEW COMMANDS?
|
||||
* - Register the command in loadAllSlashCommands() & loadAllTextCommands() in (./src/data/framework/commandLoader.ts)
|
||||
* - Add autocomplete for the command in OD(Slash/Text)CommandManagerIds_Default in (./src/core/api/defaults/client.ts)
|
||||
* - Add the command to the help menu in (./src/data/framework/helpMenuLoader.ts)
|
||||
* - If required, new config variables should be added (incl. logs, dm-logs & permissions).
|
||||
* - Update the Open Ticket Documentation.
|
||||
* - If the command contains complex logic or can be executed from a button/dropdown, it should be placed inside an `ODAction`.
|
||||
* - Check all files, test the bot carefully & try a lot of different scenario's with different settings.
|
||||
*/
|
||||
|
||||
export const loadAllHelpMenuCategories = async () => {
|
||||
const helpmenu = opendiscord.helpmenu
|
||||
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
import {opendiscord, api, utilities} from "../../index"
|
||||
|
||||
/** (CONTRIBUTOR GUIDE) HOW TO ADD NEW LANGUAGES?
|
||||
* - Add the file to (./languages/) and make sure the metadata is valid.
|
||||
* - Register the language in loadAllLanguages() in (./src/data/framework/languageLoader.ts).
|
||||
* - Add autocomplete for the language in ODLanguageManagerIds_Default in (./src/core/api/defaults/language.ts).
|
||||
* - Update the language list in the README.md translator list.
|
||||
* - Update the 2 language counters in the README.md features list.
|
||||
* - Update the Open Ticket Documentation.
|
||||
*/
|
||||
|
||||
export const loadAllLanguages = async () => {
|
||||
//register languages
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:custom","custom.json"))
|
||||
@@ -31,11 +40,4 @@ export const loadAllLanguages = async () => {
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:swedish","swedish.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:vietnamese","vietnamese.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:persian","persian.json"))
|
||||
|
||||
/** How to add more languages?
|
||||
* - Register the language to the manager (see above)
|
||||
* - Add the language to the list in the "ODLanguageManagerIds_Default" interface (./src/core/api/defaults/language.ts)
|
||||
* - Update the language list in the README.md translator list
|
||||
* - Update the language counter in the README.md features list
|
||||
*/
|
||||
}
|
||||
Reference in New Issue
Block a user