@open-discord-bots/framework 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/LICENSE.md +713 -0
  2. package/README.md +104 -0
  3. package/dist/api/api.d.ts +26 -0
  4. package/dist/api/api.js +44 -0
  5. package/dist/api/main.d.ts +133 -0
  6. package/dist/api/main.js +87 -0
  7. package/dist/api/modules/action.d.ts +34 -0
  8. package/dist/api/modules/action.js +58 -0
  9. package/dist/api/modules/base.d.ts +329 -0
  10. package/dist/api/modules/base.js +804 -0
  11. package/dist/api/modules/builder.d.ts +647 -0
  12. package/dist/api/modules/builder.js +1441 -0
  13. package/dist/api/modules/checker.d.ts +648 -0
  14. package/dist/api/modules/checker.js +1324 -0
  15. package/dist/api/modules/client.d.ts +768 -0
  16. package/dist/api/modules/client.js +1859 -0
  17. package/dist/api/modules/code.d.ts +33 -0
  18. package/dist/api/modules/code.js +57 -0
  19. package/dist/api/modules/config.d.ts +70 -0
  20. package/dist/api/modules/config.js +206 -0
  21. package/dist/api/modules/console.d.ts +305 -0
  22. package/dist/api/modules/console.js +598 -0
  23. package/dist/api/modules/cooldown.d.ts +138 -0
  24. package/dist/api/modules/cooldown.js +359 -0
  25. package/dist/api/modules/database.d.ts +135 -0
  26. package/dist/api/modules/database.js +271 -0
  27. package/dist/api/modules/event.d.ts +43 -0
  28. package/dist/api/modules/event.js +100 -0
  29. package/dist/api/modules/flag.d.ts +40 -0
  30. package/dist/api/modules/flag.js +72 -0
  31. package/dist/api/modules/fuse.d.ts +218 -0
  32. package/dist/api/modules/fuse.js +123 -0
  33. package/dist/api/modules/helpmenu.d.ts +106 -0
  34. package/dist/api/modules/helpmenu.js +167 -0
  35. package/dist/api/modules/language.d.ts +85 -0
  36. package/dist/api/modules/language.js +195 -0
  37. package/dist/api/modules/permission.d.ts +121 -0
  38. package/dist/api/modules/permission.js +314 -0
  39. package/dist/api/modules/plugin.d.ts +128 -0
  40. package/dist/api/modules/plugin.js +168 -0
  41. package/dist/api/modules/post.d.ts +44 -0
  42. package/dist/api/modules/post.js +92 -0
  43. package/dist/api/modules/progressbar.d.ts +108 -0
  44. package/dist/api/modules/progressbar.js +233 -0
  45. package/dist/api/modules/responder.d.ts +506 -0
  46. package/dist/api/modules/responder.js +1468 -0
  47. package/dist/api/modules/session.d.ts +58 -0
  48. package/dist/api/modules/session.js +171 -0
  49. package/dist/api/modules/startscreen.d.ts +165 -0
  50. package/dist/api/modules/startscreen.js +293 -0
  51. package/dist/api/modules/stat.d.ts +142 -0
  52. package/dist/api/modules/stat.js +293 -0
  53. package/dist/api/modules/verifybar.d.ts +54 -0
  54. package/dist/api/modules/verifybar.js +60 -0
  55. package/dist/api/modules/worker.d.ts +41 -0
  56. package/dist/api/modules/worker.js +93 -0
  57. package/dist/api/utils.d.ts +61 -0
  58. package/dist/api/utils.js +254 -0
  59. package/dist/index.d.ts +4 -1
  60. package/dist/index.js +40 -0
  61. package/dist/startup/dump.d.ts +14 -0
  62. package/dist/startup/dump.js +79 -0
  63. package/dist/startup/errorHandling.d.ts +2 -0
  64. package/dist/startup/errorHandling.js +43 -0
  65. package/dist/startup/pluginLauncher.d.ts +2 -0
  66. package/dist/startup/pluginLauncher.js +202 -0
  67. package/package.json +9 -3
  68. package/src/api/api.ts +29 -0
  69. package/src/api/main.ts +189 -0
  70. package/src/api/modules/action.ts +58 -0
  71. package/src/api/modules/base.ts +811 -0
  72. package/src/api/modules/builder.ts +1554 -0
  73. package/src/api/modules/checker.ts +1549 -0
  74. package/src/api/modules/client.ts +2247 -0
  75. package/src/api/modules/code.ts +58 -0
  76. package/src/api/modules/config.ts +159 -0
  77. package/src/api/modules/console.ts +665 -0
  78. package/src/api/modules/cooldown.ts +348 -0
  79. package/src/api/modules/database.ts +278 -0
  80. package/src/api/modules/event.ts +99 -0
  81. package/src/api/modules/flag.ts +73 -0
  82. package/src/api/modules/fuse.ts +348 -0
  83. package/src/api/modules/helpmenu.ts +216 -0
  84. package/src/api/modules/language.ts +201 -0
  85. package/src/api/modules/permission.ts +340 -0
  86. package/src/api/modules/plugin.ts +242 -0
  87. package/src/api/modules/post.ts +90 -0
  88. package/src/api/modules/progressbar.ts +232 -0
  89. package/src/api/modules/responder.ts +1420 -0
  90. package/src/api/modules/session.ts +155 -0
  91. package/src/api/modules/startscreen.ts +320 -0
  92. package/src/api/modules/stat.ts +313 -0
  93. package/src/api/modules/verifybar.ts +61 -0
  94. package/src/api/modules/worker.ts +93 -0
  95. package/src/api/utils.ts +206 -0
  96. package/src/cli/cli.ts +151 -0
  97. package/src/cli/editConfig.ts +943 -0
  98. package/src/index.ts +6 -1
  99. package/src/startup/compilation.ts +186 -0
  100. package/src/startup/dump.ts +45 -0
  101. package/src/startup/errorHandling.ts +38 -0
  102. package/src/startup/pluginLauncher.ts +261 -0
  103. package/LICENSE +0 -21
@@ -0,0 +1,648 @@
1
+ import { ODDiscordIdType, ODId, ODManager, ODManagerData, ODValidId, ODValidJsonType } from "./base";
2
+ import { ODConfig } from "./config";
3
+ import { ODLanguageManager } from "./language";
4
+ import { ODDebugger } from "./console";
5
+ /**## ODCheckerResult `interface`
6
+ * This interface is the result from a config checker check() function.
7
+ */
8
+ export interface ODCheckerResult {
9
+ valid: boolean;
10
+ messages: ODCheckerMessage[];
11
+ }
12
+ /**## ODCheckerManager `class`
13
+ * This is an Open Discord checker manager.
14
+ *
15
+ * It manages all config checkers in the bot and allows plugins to access config checkers from Open Discord & other plugins!
16
+ *
17
+ * You can use this class to get/add a config checker (`ODChecker`) in your plugin!
18
+ */
19
+ export declare class ODCheckerManager extends ODManager<ODChecker> {
20
+ /**The global temporary storage shared between all config checkers. */
21
+ storage: ODCheckerStorage;
22
+ /**The class responsible for rendering the config checker report. */
23
+ renderer: ODCheckerRenderer;
24
+ /**The class responsible for translating the config checker report. */
25
+ translation: ODCheckerTranslationRegister;
26
+ /**Final functions are global functions executed just before the report is created. */
27
+ functions: ODCheckerFunctionManager;
28
+ /**A variable containing the last result returned from `checkAll()` */
29
+ lastResult: ODCheckerResult | null;
30
+ constructor(debug: ODDebugger, storage: ODCheckerStorage, renderer: ODCheckerRenderer, translation: ODCheckerTranslationRegister, functions: ODCheckerFunctionManager);
31
+ /**Check all config checkers registered in this manager.*/
32
+ checkAll(sort: boolean): ODCheckerResult;
33
+ /**Create temporary and unlisted `ODConfig`, `ODChecker` & `ODCheckerStorage` classes. This will help you use a `ODCheckerStructure` validator without officially registering it in `opendiscord.checkers`. */
34
+ createTemporaryCheckerEnvironment(): ODChecker;
35
+ }
36
+ /**## ODCheckerStorage `class`
37
+ * This is an Open Discord checker storage.
38
+ *
39
+ * It stores temporary data to share between config checkers!
40
+ * (e.g. The `messages.json` needs to access the `"id"` from `options.json`)
41
+ *
42
+ *
43
+ * You can use this class when you create your own config checker implementation! (not required for using the built-in config checker)
44
+ */
45
+ export declare class ODCheckerStorage {
46
+ /**This is the array that stores all the data. ❌ **(don't edit unless really needed!)***/
47
+ storage: {
48
+ source: ODId;
49
+ key: string;
50
+ value: any;
51
+ }[];
52
+ /**Get data from the database (`source` => id of `ODChecker`) */
53
+ get(source: ODValidId, key: string): any | null;
54
+ /**Add data to the database (`source` => id of `ODChecker`). This function also overwrites existing data!*/
55
+ set(source: ODValidId, key: string, value: any): boolean;
56
+ /**Delete data from the database (`source` => id of `ODChecker`) */
57
+ delete(source: ODValidId, key: string): boolean;
58
+ /**Reset the entire database */
59
+ reset(): void;
60
+ }
61
+ /**## ODCheckerRenderer `class`
62
+ * This is an Open Discord checker renderer.
63
+ *
64
+ * It's responsible for rendering the config checker result in the console.
65
+ * This class doesn't provide any components! You need to create them by extending this class
66
+ *
67
+ * You can use this class if you want to change how the config checker looks!
68
+ */
69
+ export declare class ODCheckerRenderer {
70
+ /**Get all components */
71
+ getComponents(compact: boolean, renderEmpty: boolean, translation: ODCheckerTranslationRegister, data: ODCheckerResult): string[];
72
+ /**Render all components */
73
+ render(components: string[]): void;
74
+ }
75
+ /**## ODCheckerTranslationRegister `class`
76
+ * This is an Open Discord checker translation register.
77
+ *
78
+ * It's used to store & manage the translation for each message from the config checker!
79
+ * Most translations are stored by message id, but there are some exceptions like the additional text on the checker report.
80
+ *
81
+ * You can use this class if you want to translate your config checker messages! **This is optional & isn't required for the checker to work!**
82
+ */
83
+ export declare class ODCheckerTranslationRegister {
84
+ #private;
85
+ /**Get the translation from a config checker message/sentence */
86
+ get(type: "message" | "other", id: string): string | null;
87
+ /**Set the translation for a config checker message/sentence. This function also overwrites existing translations!*/
88
+ set(type: "message" | "other", id: string, translation: string): boolean;
89
+ /**Delete the translation for a config checker message/sentence. */
90
+ delete(type: "message" | "other", id: string): boolean;
91
+ /**Get all translations */
92
+ getAll(): {
93
+ type: "message" | "other";
94
+ id: string;
95
+ translation: string;
96
+ }[];
97
+ /**Insert the translation params into the text. */
98
+ insertTranslationParams(text: string, translationParams: string[]): string;
99
+ /**A shortcut to copy translations from the `ODLanguageManager` to `ODCheckerTranslationRegister` */
100
+ quickTranslate(manager: ODLanguageManager, translationId: string, type: "other" | "message", id: string): void;
101
+ }
102
+ /**## ODCheckerFunctionCallback `type`
103
+ * This is the function used in the `ODCheckerFunction` class.
104
+ */
105
+ export type ODCheckerFunctionCallback = (manager: ODCheckerManager, functions: ODCheckerFunctionManager) => ODCheckerResult;
106
+ /**## ODCheckerFunction `class`
107
+ * This is an Open Discord config checker function.
108
+ *
109
+ * It is a global function that will be executed after all config checkers. It can do additional checks for invalid/missing configurations.
110
+ * It's mostly used for things that need to be checked globally!
111
+ */
112
+ export declare class ODCheckerFunction extends ODManagerData {
113
+ /**The function which will be executed globally after all config checkers. */
114
+ func: ODCheckerFunctionCallback;
115
+ constructor(id: ODValidId, func: ODCheckerFunctionCallback);
116
+ }
117
+ /**## ODCheckerFunctionManager `class`
118
+ * This is an Open Discord config checker function manager.
119
+ *
120
+ * It manages all `ODCheckerFunction`'s and it has some extra shortcuts for frequently used methods.
121
+ */
122
+ export declare class ODCheckerFunctionManager extends ODManager<ODCheckerFunction> {
123
+ constructor(debug: ODDebugger);
124
+ /**A shortcut to create a warning, info or error message */
125
+ createMessage(checkerId: ODValidId, id: ODValidId, filepath: string, type: "info" | "warning" | "error", message: string, locationTrace: ODCheckerLocationTrace, docs: string | null, translationParams: string[], locationId: ODId, locationDocs: string | null): ODCheckerMessage;
126
+ /**Create a string from the location trace (path)*/
127
+ locationTraceToString(trace: ODCheckerLocationTrace): string;
128
+ /**De-reference the locationTrace array. Use this before adding a value to the array*/
129
+ locationTraceDeref(trace: ODCheckerLocationTrace): ODCheckerLocationTrace;
130
+ }
131
+ /**## ODCheckerLocationTrace `type`
132
+ * This type is an array of strings & numbers which represents the location trace from the config checker.
133
+ * It's used to generate a path to the error (e.g. `"abc"."efg".1."something"`)
134
+ */
135
+ export type ODCheckerLocationTrace = (string | number)[];
136
+ /**## ODCheckerOptions `interface`
137
+ * This interface contains all optional properties to customise in the `ODChecker` class.
138
+ */
139
+ export interface ODCheckerOptions {
140
+ /**The name of this config in the Interactive Setup CLI. */
141
+ cliDisplayName?: string;
142
+ /**The description of this config in the Interactive Setup CLI. */
143
+ cliDisplayDescription?: string;
144
+ }
145
+ /**## ODChecker `class`
146
+ * This is an Open Discord config checker.
147
+ *
148
+ * It checks a specific config file for invalid/missing configurations. This data can then be used to show to the user what's wrong!
149
+ * You can check for example if a string is longer/shorter than a certain amount of characters & more!
150
+ *
151
+ * You can use this class when you create your own custom config file & you want to check it for syntax errors.
152
+ */
153
+ export declare class ODChecker extends ODManagerData {
154
+ #private;
155
+ /**The storage of this checker (reference for `ODCheckerManager.storage`) */
156
+ storage: ODCheckerStorage;
157
+ /**The higher the priority, the faster it gets checked! */
158
+ priority: number;
159
+ /**The config file that needs to be checked */
160
+ config: ODConfig;
161
+ /**The structure of the config file */
162
+ structure: ODCheckerStructure;
163
+ /**Temporary storage for all error messages from the check() method (not recommended to use) */
164
+ messages: ODCheckerMessage[];
165
+ /**Temporary storage for the quit status from the check() method (not recommended to use) */
166
+ quit: boolean;
167
+ /**All additional properties of this config checker. */
168
+ options: ODCheckerOptions;
169
+ constructor(id: ODValidId, storage: ODCheckerStorage, priority: number, config: ODConfig, structure: ODCheckerStructure, options?: ODCheckerOptions);
170
+ /**Run this checker. Returns all errors*/
171
+ check(): ODCheckerResult;
172
+ /**Create a string from the location trace/path in a human readable format. */
173
+ locationTraceToString(trace: ODCheckerLocationTrace): string;
174
+ /**De-reference the locationTrace array. Use this before adding a value to the array*/
175
+ locationTraceDeref(trace: ODCheckerLocationTrace): ODCheckerLocationTrace;
176
+ /**A shortcut to create a warning, info or error message */
177
+ createMessage(id: ODValidId, type: "info" | "warning" | "error", message: string, locationTrace: ODCheckerLocationTrace, docs: string | null, translationParams: string[], locationId: ODId, locationDocs: string | null): void;
178
+ }
179
+ /**## ODCheckerMessage `interface`
180
+ * This interface is an object which has all variables required for a config checker message!
181
+ */
182
+ export interface ODCheckerMessage {
183
+ checkerId: ODId;
184
+ messageId: ODId;
185
+ locationId: ODId;
186
+ type: "info" | "warning" | "error";
187
+ message: string;
188
+ path: string;
189
+ filepath: string;
190
+ translationParams: string[];
191
+ messageDocs: string | null;
192
+ locationDocs: string | null;
193
+ }
194
+ /**## ODCheckerStructureOptions `interface`
195
+ * This interface has the basic options for the `ODCheckerStructure`!
196
+ */
197
+ export interface ODCheckerStructureOptions {
198
+ /**Add a custom checker function. Returns `true` when valid. */
199
+ custom?: (checker: ODChecker, value: ODValidJsonType, locationTrace: ODCheckerLocationTrace, locationId: ODId, locationDocs: string | null) => boolean;
200
+ /**Set the url to the documentation of this variable. */
201
+ docs?: string;
202
+ /**The name of this config in the Interactive Setup CLI. */
203
+ cliDisplayName?: string;
204
+ /**The description of this config in the Interactive Setup CLI. */
205
+ cliDisplayDescription?: string;
206
+ /**Hide the description of this config in the Interactive Setup CLI parent view/list. */
207
+ cliHideDescriptionInParent?: boolean;
208
+ /**The default value of this variable when creating it in the Interactive Setup CLI. When not specified, the user will be asked to insert a value. */
209
+ cliInitDefaultValue?: ODValidJsonType;
210
+ }
211
+ /**## ODCheckerStructure `class`
212
+ * This is an Open Discord config checker structure.
213
+ *
214
+ * This class will check for a single variable in a config file, customise it in the settings!
215
+ * If you want prebuilt checkers (for strings, booleans, numbers, ...), check the other `ODCheckerStructure`'s!
216
+ *
217
+ * **Not recommended to use!** It's recommended to extend from another `ODConfigCheckerStructure` class!
218
+ */
219
+ export declare class ODCheckerStructure {
220
+ /**The id of this checker structure */
221
+ id: ODId;
222
+ /**The options for this checker structure */
223
+ options: ODCheckerStructureOptions;
224
+ constructor(id: ODValidId, options: ODCheckerStructureOptions);
225
+ /**Check a variable if it matches all settings in this checker. This function is automatically executed by Open Discord! */
226
+ check(checker: ODChecker, value: ODValidJsonType, locationTrace: ODCheckerLocationTrace): boolean;
227
+ }
228
+ /**## ODCheckerObjectStructureOptions `interface`
229
+ * This interface has the options for `ODCheckerObjectStructure`!
230
+ */
231
+ export interface ODCheckerObjectStructureOptions extends ODCheckerStructureOptions {
232
+ /**Add a checker for a property in an object (can also be optional) */
233
+ children: {
234
+ key: string;
235
+ priority?: number;
236
+ optional?: boolean;
237
+ cliHideInEditMode?: boolean;
238
+ checker: ODCheckerStructure;
239
+ }[];
240
+ /**A list of keys to skip when creating this object with the Interactive Setup CLI. The default value of these properties will be used instead. */
241
+ cliInitSkipKeys?: string[];
242
+ /**The key of a (primitive) property in this object to show the value of in the Interactive Setup CLI when listed in an array. */
243
+ cliDisplayKeyInParentArray?: string;
244
+ /**A list of additional (primitive) property keys in this object to show the value of in the Interactive Setup CLI when listed in an array. */
245
+ cliDisplayAdditionalKeysInParentArray?: string[];
246
+ }
247
+ /**## ODCheckerObjectStructure `class`
248
+ * This is an Open Discord config checker structure.
249
+ *
250
+ * This class will check for an object variable in a config file, customise it in the settings!
251
+ * A checker for the children can be set in the settings.
252
+ */
253
+ export declare class ODCheckerObjectStructure extends ODCheckerStructure {
254
+ options: ODCheckerObjectStructureOptions;
255
+ constructor(id: ODValidId, options: ODCheckerObjectStructureOptions);
256
+ check(checker: ODChecker, value: object, locationTrace: ODCheckerLocationTrace): boolean;
257
+ }
258
+ /**## ODCheckerStringStructureOptions `interface`
259
+ * This interface has the options for `ODCheckerStringStructure`!
260
+ */
261
+ export interface ODCheckerStringStructureOptions extends ODCheckerStructureOptions {
262
+ /**The minimum length of this string */
263
+ minLength?: number;
264
+ /**The maximum length of this string */
265
+ maxLength?: number;
266
+ /**Set the required length of this string */
267
+ length?: number;
268
+ /**This string needs to start with ... */
269
+ startsWith?: string;
270
+ /**This string needs to end with ... */
271
+ endsWith?: string;
272
+ /**This string needs to contain ... */
273
+ contains?: string;
274
+ /**This string is not allowed to contain ... */
275
+ invertedContains?: string;
276
+ /**You need to choose between ... */
277
+ choices?: string[];
278
+ /**This string needs to be in lowercase. */
279
+ lowercaseOnly?: boolean;
280
+ /**This string needs to be in uppercase. */
281
+ uppercaseOnly?: boolean;
282
+ /**This string shouldn't contain any special characters (allowed: A-Z, a-z, 0-9, space, a few punctuation marks, ...). */
283
+ noSpecialCharacters?: boolean;
284
+ /**Do not allow any spaces in this string. */
285
+ withoutSpaces?: boolean;
286
+ /**Give a warning when a sentence doesn't start with a capital letter. Or require every word to start with a capital letter. (Ignores numbers, unicode characters, ...) */
287
+ capitalLetterWarning?: false | "sentence" | "word";
288
+ /**Give a warning when a sentence doesn't end with a punctuation letter (.,?!) */
289
+ punctuationWarning?: boolean;
290
+ /**The string needs to match this regex */
291
+ regex?: RegExp;
292
+ /**Provide an optional list for autocomplete when using the Interactive Setup CLI. Defaults to the `choices` option. */
293
+ cliAutocompleteList?: string[];
294
+ /**Dynamically provide a list for autocomplete items when using the Interactive Setup CLI. */
295
+ cliAutocompleteFunc?: () => Promise<string[] | null>;
296
+ }
297
+ /**## ODCheckerStringStructure `class`
298
+ * This is an Open Discord config checker structure.
299
+ *
300
+ * This class will check for a string variable in a config file, customise it in the settings!
301
+ */
302
+ export declare class ODCheckerStringStructure extends ODCheckerStructure {
303
+ options: ODCheckerStringStructureOptions;
304
+ constructor(id: ODValidId, options: ODCheckerStringStructureOptions);
305
+ check(checker: ODChecker, value: string, locationTrace: ODCheckerLocationTrace): boolean;
306
+ }
307
+ /**## ODCheckerNumberStructureOptions `interface`
308
+ * This interface has the options for `ODCheckerNumberStructure`!
309
+ */
310
+ export interface ODCheckerNumberStructureOptions extends ODCheckerStructureOptions {
311
+ /**Is `NaN` (not a number) allowed? (`false` by default) */
312
+ nanAllowed?: boolean;
313
+ /**The minimum length of this number */
314
+ minLength?: number;
315
+ /**The maximum length of this number */
316
+ maxLength?: number;
317
+ /**Set the required length of this number */
318
+ length?: number;
319
+ /**The minimum value of this number */
320
+ min?: number;
321
+ /**The maximum value of this number */
322
+ max?: number;
323
+ /**This number is required to match the value */
324
+ is?: number;
325
+ /**Only allow a multiple of ... starting at `this.offset` or 0 */
326
+ step?: number;
327
+ /**The offset for the step function. */
328
+ offset?: number;
329
+ /**This number needs to start with ... */
330
+ startsWith?: string;
331
+ /**This number needs to end with ... */
332
+ endsWith?: string;
333
+ /**This number needs to contain ... */
334
+ contains?: string;
335
+ /**This number is not allowed to contain ... */
336
+ invertedContains?: string;
337
+ /**You need to choose between ... */
338
+ choices?: number[];
339
+ /**Are numbers with a decimal value allowed? */
340
+ floatAllowed?: boolean;
341
+ /**Are negative numbers allowed (without zero) */
342
+ negativeAllowed?: boolean;
343
+ /**Are positive numers allowed (without zero) */
344
+ positiveAllowed?: boolean;
345
+ /**Is zero allowed? */
346
+ zeroAllowed?: boolean;
347
+ }
348
+ /**## ODCheckerNumberStructure `class`
349
+ * This is an Open Discord config checker structure.
350
+ *
351
+ * This class will check for a number variable in a config file, customise it in the settings!
352
+ */
353
+ export declare class ODCheckerNumberStructure extends ODCheckerStructure {
354
+ options: ODCheckerNumberStructureOptions;
355
+ constructor(id: ODValidId, options: ODCheckerNumberStructureOptions);
356
+ check(checker: ODChecker, value: number, locationTrace: ODCheckerLocationTrace): boolean;
357
+ }
358
+ /**## ODCheckerBooleanStructureOptions `interface`
359
+ * This interface has the options for `ODCheckerBooleanStructure`!
360
+ */
361
+ export interface ODCheckerBooleanStructureOptions extends ODCheckerStructureOptions {
362
+ /**Is `true` allowed? */
363
+ trueAllowed?: boolean;
364
+ /**Is `false` allowed? */
365
+ falseAllowed?: boolean;
366
+ }
367
+ /**## ODCheckerBooleanStructure `class`
368
+ * This is an Open Discord config checker structure.
369
+ *
370
+ * This class will check for a boolean variable in a config file, customise it in the settings!
371
+ */
372
+ export declare class ODCheckerBooleanStructure extends ODCheckerStructure {
373
+ options: ODCheckerBooleanStructureOptions;
374
+ constructor(id: ODValidId, options: ODCheckerBooleanStructureOptions);
375
+ check(checker: ODChecker, value: boolean, locationTrace: ODCheckerLocationTrace): boolean;
376
+ }
377
+ /**## ODCheckerArrayStructureOptions `interface`
378
+ * This interface has the options for `ODCheckerArrayStructure`!
379
+ */
380
+ export interface ODCheckerArrayStructureOptions extends ODCheckerStructureOptions {
381
+ /**The checker for all the properties in this array */
382
+ propertyChecker?: ODCheckerStructure;
383
+ /**Don't allow this array to be empty */
384
+ disableEmpty?: boolean;
385
+ /**This array is required to be empty */
386
+ emptyRequired?: boolean;
387
+ /**The minimum length of this array */
388
+ minLength?: number;
389
+ /**The maximum length of this array */
390
+ maxLength?: number;
391
+ /**The length of the array needs to be the same as this value */
392
+ length?: number;
393
+ /**Allow double values (only for `string`, `number` & `boolean`) */
394
+ allowDoubles?: boolean;
395
+ /**Only allow these types in the array (for multi-type propertyCheckers) */
396
+ allowedTypes?: ("string" | "number" | "boolean" | "null" | "array" | "object" | "other")[];
397
+ /**The name of the properties inside this array. Used in the GUI of the Interactive Setup CLI. */
398
+ cliDisplayPropertyName?: string;
399
+ }
400
+ /**## ODCheckerArrayStructure `class`
401
+ * This is an Open Discord config checker structure.
402
+ *
403
+ * This class will check for an array variable in a config file, customise it in the settings!
404
+ */
405
+ export declare class ODCheckerArrayStructure extends ODCheckerStructure {
406
+ #private;
407
+ options: ODCheckerArrayStructureOptions;
408
+ constructor(id: ODValidId, options: ODCheckerArrayStructureOptions);
409
+ check(checker: ODChecker, value: Array<any>, locationTrace: ODCheckerLocationTrace): boolean;
410
+ }
411
+ /**## ODCheckerNullStructureOptions `interface`
412
+ * This interface has the options for `ODCheckerNullStructure`!
413
+ */
414
+ export interface ODCheckerNullStructureOptions extends ODCheckerStructureOptions {
415
+ /**Is the value allowed to be null */
416
+ nullAllowed?: boolean;
417
+ }
418
+ /**## ODCheckerNullStructure `class`
419
+ * This is an Open Discord config checker structure.
420
+ *
421
+ * This class will check for a null variable in a config file, customise it in the settings!
422
+ */
423
+ export declare class ODCheckerNullStructure extends ODCheckerStructure {
424
+ options: ODCheckerNullStructureOptions;
425
+ constructor(id: ODValidId, options: ODCheckerNullStructureOptions);
426
+ check(checker: ODChecker, value: null, locationTrace: ODCheckerLocationTrace): boolean;
427
+ }
428
+ /**## ODCheckerTypeSwitchStructureOptions `interface`
429
+ * This interface has the options for `ODCheckerTypeSwitchStructure`!
430
+ */
431
+ export interface ODCheckerTypeSwitchStructureOptions extends ODCheckerStructureOptions {
432
+ /**A checker that will always run (replaces all other checkers) */
433
+ all?: ODCheckerStructure;
434
+ /**A checker when the property is a string */
435
+ string?: ODCheckerStringStructure;
436
+ /**A checker when the property is a number */
437
+ number?: ODCheckerNumberStructure;
438
+ /**A checker when the property is a boolean */
439
+ boolean?: ODCheckerBooleanStructure;
440
+ /**A checker when the property is null */
441
+ null?: ODCheckerNullStructure;
442
+ /**A checker when the property is an array */
443
+ array?: ODCheckerArrayStructure;
444
+ /**A checker when the property is an object */
445
+ object?: ODCheckerObjectStructure;
446
+ /**A checker when the property is something else */
447
+ other?: ODCheckerStructure;
448
+ /**A list of allowed types */
449
+ allowedTypes: ("string" | "number" | "boolean" | "null" | "array" | "object" | "other")[];
450
+ }
451
+ /**## ODCheckerTypeSwitchStructure `class`
452
+ * This is an Open Discord config checker structure.
453
+ *
454
+ * This class will switch checkers based on the type of the variable in a config file, customise it in the settings!
455
+ */
456
+ export declare class ODCheckerTypeSwitchStructure extends ODCheckerStructure {
457
+ options: ODCheckerTypeSwitchStructureOptions;
458
+ constructor(id: ODValidId, options: ODCheckerTypeSwitchStructureOptions);
459
+ check(checker: ODChecker, value: any, locationTrace: ODCheckerLocationTrace): boolean;
460
+ }
461
+ /**## ODCheckerObjectSwitchStructureOptions `interface`
462
+ * This interface has the options for `ODCheckerObjectSwitchStructure`!
463
+ */
464
+ export interface ODCheckerObjectSwitchStructureOptions extends ODCheckerStructureOptions {
465
+ /**An array of object checkers with their name, properties & priority. */
466
+ objects: {
467
+ /**The properties to match for this checker to be used. */
468
+ properties: {
469
+ key: string;
470
+ value: boolean | string | number;
471
+ }[];
472
+ /**The name for this object type (used in rendering) */
473
+ name: string;
474
+ /**The higher the priority, the earlier this checker will be tested. */
475
+ priority: number;
476
+ /**The object checker used once the properties have been matched. */
477
+ checker: ODCheckerObjectStructure;
478
+ }[];
479
+ }
480
+ /**## ODCheckerObjectSwitchStructure `class`
481
+ * This is an Open Discord config checker structure.
482
+ *
483
+ * This class will switch object checkers based on a variable match in one of the objects, customise it in the settings!
484
+ */
485
+ export declare class ODCheckerObjectSwitchStructure extends ODCheckerStructure {
486
+ options: ODCheckerObjectSwitchStructureOptions;
487
+ constructor(id: ODValidId, options: ODCheckerObjectSwitchStructureOptions);
488
+ check(checker: ODChecker, value: object, locationTrace: ODCheckerLocationTrace): boolean;
489
+ }
490
+ /**## ODCheckerEnabledObjectStructureOptions `interface`
491
+ * This interface has the options for `ODCheckerEnabledObjectStructure`!
492
+ */
493
+ export interface ODCheckerEnabledObjectStructureOptions extends ODCheckerStructureOptions {
494
+ /**The name of the property to match the `enabledValue`. */
495
+ property: string;
496
+ /**The value of the property to be enabled. (e.g. `true`) */
497
+ enabledValue: boolean | string | number;
498
+ /**The object checker to use once the property has been matched. */
499
+ checker: ODCheckerObjectStructure;
500
+ }
501
+ /**## ODCheckerEnabledObjectStructure `class`
502
+ * This is an Open Discord config checker structure.
503
+ *
504
+ * This class will enable an object checker based on a variable match in the object, customise it in the settings!
505
+ */
506
+ export declare class ODCheckerEnabledObjectStructure extends ODCheckerStructure {
507
+ options: ODCheckerEnabledObjectStructureOptions;
508
+ constructor(id: ODValidId, options: ODCheckerEnabledObjectStructureOptions);
509
+ check(checker: ODChecker, value: object, locationTrace: ODCheckerLocationTrace): boolean;
510
+ }
511
+ /**## ODCheckerCustomStructure_DiscordId `class`
512
+ * This is an Open Discord custom checker structure.
513
+ *
514
+ * This class extends a primitive config checker & adds another layer of checking in the `custom` function.
515
+ * You can compare it to a blueprint for a specific checker.
516
+ *
517
+ * **This custom checker is made for discord ids (channel, user, role, ...)**
518
+ */
519
+ export declare class ODCheckerCustomStructure_DiscordId extends ODCheckerStringStructure {
520
+ /**The type of id (used in rendering) */
521
+ readonly type: ODDiscordIdType;
522
+ /**Is this id allowed to be empty */
523
+ readonly emptyAllowed: boolean;
524
+ /**Extra matches (value will also be valid when one of these options match) */
525
+ readonly extraOptions: string[];
526
+ constructor(id: ODValidId, type: ODDiscordIdType, emptyAllowed: boolean, extraOptions: string[], options?: ODCheckerStringStructureOptions);
527
+ }
528
+ /**## ODCheckerCustomStructure_DiscordIdArray `class`
529
+ * This is an Open Discord custom checker structure.
530
+ *
531
+ * This class extends a primitive config checker & adds another layer of checking in the `custom` function.
532
+ * You can compare it to a blueprint for a specific checker.
533
+ *
534
+ * **This custom checker is made for discord id arrays (channel, user, role, ...)**
535
+ */
536
+ export declare class ODCheckerCustomStructure_DiscordIdArray extends ODCheckerArrayStructure {
537
+ /**The type of id (used in rendering) */
538
+ readonly type: ODDiscordIdType;
539
+ /**Extra matches (value will also be valid when one of these options match) */
540
+ readonly extraOptions: string[];
541
+ constructor(id: ODValidId, type: ODDiscordIdType, extraOptions: string[], options?: ODCheckerArrayStructureOptions, idOptions?: ODCheckerStringStructureOptions);
542
+ }
543
+ /**## ODCheckerCustomStructure_DiscordToken `class`
544
+ * This is an Open Discord custom checker structure.
545
+ *
546
+ * This class extends a primitive config checker & adds another layer of checking in the `custom` function.
547
+ * You can compare it to a blueprint for a specific checker.
548
+ *
549
+ * **This custom checker is made for a discord (auth) token**
550
+ */
551
+ export declare class ODCheckerCustomStructure_DiscordToken extends ODCheckerStringStructure {
552
+ constructor(id: ODValidId, options?: ODCheckerStringStructureOptions);
553
+ }
554
+ /**## ODCheckerCustomStructure_DiscordToken `class`
555
+ * This is an Open Discord custom checker structure.
556
+ *
557
+ * This class extends a primitive config checker & adds another layer of checking in the `custom` function.
558
+ * You can compare it to a blueprint for a specific checker.
559
+ *
560
+ * **This custom checker is made for a hex color**
561
+ */
562
+ export declare class ODCheckerCustomStructure_HexColor extends ODCheckerStringStructure {
563
+ /**When enabled, you are also allowed to use `#fff` instead of `#ffffff` */
564
+ readonly allowShortForm: boolean;
565
+ /**Allow this hex color to be empty. */
566
+ readonly emptyAllowed: boolean;
567
+ constructor(id: ODValidId, allowShortForm: boolean, emptyAllowed: boolean, options?: ODCheckerStringStructureOptions);
568
+ }
569
+ /**## ODCheckerCustomStructure_EmojiString `class`
570
+ * This is an Open Discord custom checker structure.
571
+ *
572
+ * This class extends a primitive config checker & adds another layer of checking in the `custom` function.
573
+ * You can compare it to a blueprint for a specific checker.
574
+ *
575
+ * **This custom checker is made for an emoji (string)**
576
+ */
577
+ export declare class ODCheckerCustomStructure_EmojiString extends ODCheckerStringStructure {
578
+ /**The minimum amount of emojis required (0 to allow empty) */
579
+ readonly minLength: number;
580
+ /**The maximum amount of emojis allowed */
581
+ readonly maxLength: number;
582
+ /**Allow custom discord emoji ids (`<:12345678910:emoji_name>`) */
583
+ readonly allowCustomDiscordEmoji: boolean;
584
+ constructor(id: ODValidId, minLength: number, maxLength: number, allowCustomDiscordEmoji: boolean, options?: ODCheckerStringStructureOptions);
585
+ }
586
+ /**## ODCheckerCustomStructureOptions_UrlString `interface`
587
+ * This interface has the options for `ODCheckerCustomStructure_UrlString`!
588
+ */
589
+ export interface ODCheckerCustomStructureOptions_UrlString {
590
+ /**Allow urls with `http://` instead of `https://` */
591
+ allowHttp?: boolean;
592
+ /**Allowed hostnames (string or regex) => will match domain + subdomain */
593
+ allowedHostnames?: (string | RegExp)[];
594
+ /**Allowed extentions (string) => will match the end of the url (`.png`,`.svg`,...) */
595
+ allowedExtensions?: string[];
596
+ /**Allowed paths (string or regex) => will match path + extension (not domain + subdomain) */
597
+ allowedPaths?: (string | RegExp)[];
598
+ /**A regex that will be executed on the entire url (including search params, protcol, domain, ...) */
599
+ regex?: RegExp;
600
+ }
601
+ /**## ODCheckerCustomStructure_UrlString `class`
602
+ * This is an Open Discord custom checker structure.
603
+ *
604
+ * This class extends a primitive config checker & adds another layer of checking in the `custom` function.
605
+ * You can compare it to a blueprint for a specific checker.
606
+ *
607
+ * **This custom checker is made for a URL (string)**
608
+ */
609
+ export declare class ODCheckerCustomStructure_UrlString extends ODCheckerStringStructure {
610
+ #private;
611
+ /**The settings for this url */
612
+ readonly urlSettings: ODCheckerCustomStructureOptions_UrlString;
613
+ /**Is this url allowed to be empty? */
614
+ readonly emptyAllowed: boolean;
615
+ constructor(id: ODValidId, emptyAllowed: boolean, urlSettings: ODCheckerCustomStructureOptions_UrlString, options?: ODCheckerStringStructureOptions);
616
+ }
617
+ /**## ODCheckerCustomStructure_UniqueId `class`
618
+ * This is an Open Discord custom checker structure.
619
+ *
620
+ * This class extends a primitive config checker & adds another layer of checking in the `custom` function.
621
+ * You can compare it to a blueprint for a specific checker.
622
+ *
623
+ * **This custom checker is made for a unique id (per source & scope)**
624
+ */
625
+ export declare class ODCheckerCustomStructure_UniqueId extends ODCheckerStringStructure {
626
+ /**The source of this unique id (generally the plugin name or `opendiscord`) */
627
+ readonly source: string;
628
+ /**The scope of this unique id (id needs to be unique in this scope) */
629
+ readonly scope: string;
630
+ constructor(id: ODValidId, source: string, scope: string, options?: ODCheckerStringStructureOptions);
631
+ }
632
+ /**## ODCheckerCustomStructure_UniqueIdArray `class`
633
+ * This is an Open Discord custom checker structure.
634
+ *
635
+ * This class extends a primitive config checker & adds another layer of checking in the `custom` function.
636
+ * You can compare it to a blueprint for a specific checker.
637
+ *
638
+ * **This custom checker is made for a unique id array (per source & scope)**
639
+ */
640
+ export declare class ODCheckerCustomStructure_UniqueIdArray extends ODCheckerArrayStructure {
641
+ /**The source to read unique ids (generally the plugin name or `opendiscord`) */
642
+ readonly source: string;
643
+ /**The scope to read unique ids (id needs to be unique in this scope) */
644
+ readonly scope: string;
645
+ /**The scope to push unique ids when used in this array! */
646
+ readonly usedScope: string | null;
647
+ constructor(id: ODValidId, source: string, scope: string, usedScope?: string, options?: ODCheckerArrayStructureOptions, idOptions?: Omit<ODCheckerStringStructureOptions, "minLength" | "custom">);
648
+ }