@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.
- package/LICENSE.md +713 -0
- package/README.md +104 -0
- package/dist/api/api.d.ts +26 -0
- package/dist/api/api.js +44 -0
- package/dist/api/main.d.ts +133 -0
- package/dist/api/main.js +87 -0
- package/dist/api/modules/action.d.ts +34 -0
- package/dist/api/modules/action.js +58 -0
- package/dist/api/modules/base.d.ts +329 -0
- package/dist/api/modules/base.js +804 -0
- package/dist/api/modules/builder.d.ts +647 -0
- package/dist/api/modules/builder.js +1441 -0
- package/dist/api/modules/checker.d.ts +648 -0
- package/dist/api/modules/checker.js +1324 -0
- package/dist/api/modules/client.d.ts +768 -0
- package/dist/api/modules/client.js +1859 -0
- package/dist/api/modules/code.d.ts +33 -0
- package/dist/api/modules/code.js +57 -0
- package/dist/api/modules/config.d.ts +70 -0
- package/dist/api/modules/config.js +206 -0
- package/dist/api/modules/console.d.ts +305 -0
- package/dist/api/modules/console.js +598 -0
- package/dist/api/modules/cooldown.d.ts +138 -0
- package/dist/api/modules/cooldown.js +359 -0
- package/dist/api/modules/database.d.ts +135 -0
- package/dist/api/modules/database.js +271 -0
- package/dist/api/modules/event.d.ts +43 -0
- package/dist/api/modules/event.js +100 -0
- package/dist/api/modules/flag.d.ts +40 -0
- package/dist/api/modules/flag.js +72 -0
- package/dist/api/modules/fuse.d.ts +218 -0
- package/dist/api/modules/fuse.js +123 -0
- package/dist/api/modules/helpmenu.d.ts +106 -0
- package/dist/api/modules/helpmenu.js +167 -0
- package/dist/api/modules/language.d.ts +85 -0
- package/dist/api/modules/language.js +195 -0
- package/dist/api/modules/permission.d.ts +121 -0
- package/dist/api/modules/permission.js +314 -0
- package/dist/api/modules/plugin.d.ts +128 -0
- package/dist/api/modules/plugin.js +168 -0
- package/dist/api/modules/post.d.ts +44 -0
- package/dist/api/modules/post.js +92 -0
- package/dist/api/modules/progressbar.d.ts +108 -0
- package/dist/api/modules/progressbar.js +233 -0
- package/dist/api/modules/responder.d.ts +506 -0
- package/dist/api/modules/responder.js +1468 -0
- package/dist/api/modules/session.d.ts +58 -0
- package/dist/api/modules/session.js +171 -0
- package/dist/api/modules/startscreen.d.ts +165 -0
- package/dist/api/modules/startscreen.js +293 -0
- package/dist/api/modules/stat.d.ts +142 -0
- package/dist/api/modules/stat.js +293 -0
- package/dist/api/modules/verifybar.d.ts +54 -0
- package/dist/api/modules/verifybar.js +60 -0
- package/dist/api/modules/worker.d.ts +41 -0
- package/dist/api/modules/worker.js +93 -0
- package/dist/api/utils.d.ts +61 -0
- package/dist/api/utils.js +254 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +40 -0
- package/dist/startup/dump.d.ts +14 -0
- package/dist/startup/dump.js +79 -0
- package/dist/startup/errorHandling.d.ts +2 -0
- package/dist/startup/errorHandling.js +43 -0
- package/dist/startup/pluginLauncher.d.ts +2 -0
- package/dist/startup/pluginLauncher.js +202 -0
- package/package.json +9 -3
- package/src/api/api.ts +29 -0
- package/src/api/main.ts +189 -0
- package/src/api/modules/action.ts +58 -0
- package/src/api/modules/base.ts +811 -0
- package/src/api/modules/builder.ts +1554 -0
- package/src/api/modules/checker.ts +1549 -0
- package/src/api/modules/client.ts +2247 -0
- package/src/api/modules/code.ts +58 -0
- package/src/api/modules/config.ts +159 -0
- package/src/api/modules/console.ts +665 -0
- package/src/api/modules/cooldown.ts +348 -0
- package/src/api/modules/database.ts +278 -0
- package/src/api/modules/event.ts +99 -0
- package/src/api/modules/flag.ts +73 -0
- package/src/api/modules/fuse.ts +348 -0
- package/src/api/modules/helpmenu.ts +216 -0
- package/src/api/modules/language.ts +201 -0
- package/src/api/modules/permission.ts +340 -0
- package/src/api/modules/plugin.ts +242 -0
- package/src/api/modules/post.ts +90 -0
- package/src/api/modules/progressbar.ts +232 -0
- package/src/api/modules/responder.ts +1420 -0
- package/src/api/modules/session.ts +155 -0
- package/src/api/modules/startscreen.ts +320 -0
- package/src/api/modules/stat.ts +313 -0
- package/src/api/modules/verifybar.ts +61 -0
- package/src/api/modules/worker.ts +93 -0
- package/src/api/utils.ts +206 -0
- package/src/cli/cli.ts +151 -0
- package/src/cli/editConfig.ts +943 -0
- package/src/index.ts +6 -1
- package/src/startup/compilation.ts +186 -0
- package/src/startup/dump.ts +45 -0
- package/src/startup/errorHandling.ts +38 -0
- package/src/startup/pluginLauncher.ts +261 -0
- package/LICENSE +0 -21
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**## ODFuseBooleans `type`
|
|
2
|
+
* This type is a list of boolean fuses available in the `ODFuseManager` class.
|
|
3
|
+
* It's used to generate typescript declarations for this class.
|
|
4
|
+
*/
|
|
5
|
+
export type ODFuseBooleans<FuseList extends object> = {
|
|
6
|
+
[Key in keyof FuseList]: FuseList[Key] extends boolean ? Key : never;
|
|
7
|
+
}[keyof FuseList];
|
|
8
|
+
/**## ODFuseStrings `type`
|
|
9
|
+
* This type is a list of string fuses available in the `ODFuseManager` class.
|
|
10
|
+
* It's used to generate typescript declarations for this class.
|
|
11
|
+
*/
|
|
12
|
+
export type ODFuseStrings<FuseList extends object> = {
|
|
13
|
+
[Key in keyof FuseList]: FuseList[Key] extends string ? Key : never;
|
|
14
|
+
}[keyof FuseList];
|
|
15
|
+
/**## ODFuseNumbers `type`
|
|
16
|
+
* This type is a list of number fuses available in the `ODFuseManager` class.
|
|
17
|
+
* It's used to generate typescript declarations for this class.
|
|
18
|
+
*/
|
|
19
|
+
export type ODFuseNumbers<FuseList extends object> = {
|
|
20
|
+
[Key in keyof FuseList]: FuseList[Key] extends number ? Key : never;
|
|
21
|
+
}[keyof FuseList];
|
|
22
|
+
/**## ODFuseStringArray `type`
|
|
23
|
+
* This type is a list of string[] fuses available in the `ODFuseManager` class.
|
|
24
|
+
* It's used to generate typescript declarations for this class.
|
|
25
|
+
*/
|
|
26
|
+
export type ODFuseStringArray<FuseList extends object> = {
|
|
27
|
+
[Key in keyof FuseList]: FuseList[Key] extends string[] ? Key : never;
|
|
28
|
+
}[keyof FuseList];
|
|
29
|
+
/**## ODFuseManager `class`
|
|
30
|
+
* This is an Open Discord fuse manager.
|
|
31
|
+
*
|
|
32
|
+
* It manages all settings in Open Discord that are not meant to be in the config.
|
|
33
|
+
* Here you can disable certain default features of the bot to replace them with your own implementation!
|
|
34
|
+
*
|
|
35
|
+
* You can think of them like real fuses, they disable an entire branch of the bot!
|
|
36
|
+
*/
|
|
37
|
+
export declare class ODFuseManager<FuseList extends object> {
|
|
38
|
+
/**A list of all the defaults */
|
|
39
|
+
private fuses;
|
|
40
|
+
constructor(fuses: FuseList);
|
|
41
|
+
/**Set a fuse to a specific value. Remember! All plugins can edit these values, so your value could be overwritten! */
|
|
42
|
+
setFuse<DefaultName extends keyof FuseList>(key: DefaultName, value: FuseList[DefaultName]): void;
|
|
43
|
+
/**Get a fuse. Remember! All plugins can edit these values, so this value could be overwritten! */
|
|
44
|
+
getFuse<DefaultName extends keyof FuseList>(key: DefaultName): FuseList[DefaultName];
|
|
45
|
+
}
|
|
46
|
+
/**## ODSharedFuseList `interface`
|
|
47
|
+
* This type is a list of all fuses available in the `ODSharedFuseManager` class.
|
|
48
|
+
* It's used to generate typescript declarations for this class.
|
|
49
|
+
*/
|
|
50
|
+
export interface ODSharedFuseList {
|
|
51
|
+
/**Enable the default error handling system. */
|
|
52
|
+
errorHandling: boolean;
|
|
53
|
+
/**Crash when there is an unknown bot error. */
|
|
54
|
+
crashOnError: boolean;
|
|
55
|
+
/**Enable the system responsible for the `--debug` flag. */
|
|
56
|
+
debugLoading: boolean;
|
|
57
|
+
/**Enable the system responsible for the `--silent` flag. */
|
|
58
|
+
silentLoading: boolean;
|
|
59
|
+
/**When enabled, you're able to use the "!OPENTICKET:dump" command to send the debug file. This is only possible when you're the owner of the bot. */
|
|
60
|
+
allowDumpCommand: boolean;
|
|
61
|
+
/**Enable loading all Open Discord plugins, sadly enough is only useful for the system :) */
|
|
62
|
+
pluginLoading: boolean;
|
|
63
|
+
/**Don't crash the bot when a plugin crashes! */
|
|
64
|
+
softPluginLoading: boolean;
|
|
65
|
+
/**Load the default Open Discord plugin classes. */
|
|
66
|
+
pluginClassLoading: boolean;
|
|
67
|
+
/**Load the default Open Discord flags. */
|
|
68
|
+
flagLoading: boolean;
|
|
69
|
+
/**Enable the default initializer for Open Discord flags. */
|
|
70
|
+
flagInitiating: boolean;
|
|
71
|
+
/**Load the default Open Discord progress bar renderers. */
|
|
72
|
+
progressBarRendererLoading: boolean;
|
|
73
|
+
/**Load the default Open Discord progress bars. */
|
|
74
|
+
progressBarLoading: boolean;
|
|
75
|
+
/**Load the default Open Discord configs. */
|
|
76
|
+
configLoading: boolean;
|
|
77
|
+
/**Enable the default initializer for Open Discord config. */
|
|
78
|
+
configInitiating: boolean;
|
|
79
|
+
/**Load the default Open Discord databases. */
|
|
80
|
+
databaseLoading: boolean;
|
|
81
|
+
/**Enable the default initializer for Open Discord database. */
|
|
82
|
+
databaseInitiating: boolean;
|
|
83
|
+
/**Load the default Open Discord sessions. */
|
|
84
|
+
sessionLoading: boolean;
|
|
85
|
+
/**Load the default Open Discord languages. */
|
|
86
|
+
languageLoading: boolean;
|
|
87
|
+
/**Enable the default initializer for Open Discord languages. */
|
|
88
|
+
languageInitiating: boolean;
|
|
89
|
+
/**Enable selecting the current language from `config/general.json`. */
|
|
90
|
+
languageSelection: boolean;
|
|
91
|
+
/**Set the backup language when the primary language is missing a property. */
|
|
92
|
+
backupLanguage: string;
|
|
93
|
+
/****[NOT FOR PLUGIN TRANSLATIONS]** The full list of available languages (used in the default config checker). */
|
|
94
|
+
languageList: string[];
|
|
95
|
+
/**Load the default Open Discord config checker. */
|
|
96
|
+
checkerLoading: boolean;
|
|
97
|
+
/**Load the default Open Discord config checker functions. */
|
|
98
|
+
checkerFunctionLoading: boolean;
|
|
99
|
+
/**Enable the default execution of the config checkers. */
|
|
100
|
+
checkerExecution: boolean;
|
|
101
|
+
/**Load the default Open Discord config checker translations. */
|
|
102
|
+
checkerTranslationLoading: boolean;
|
|
103
|
+
/**Enable the default rendering of the config checkers. */
|
|
104
|
+
checkerRendering: boolean;
|
|
105
|
+
/**Enable the default quit action when there is an error in the config checker. */
|
|
106
|
+
checkerQuit: boolean;
|
|
107
|
+
/**Render the checker even when there are no errors & warnings. */
|
|
108
|
+
checkerRenderEmpty: boolean;
|
|
109
|
+
/**Load the default Open Discord client configuration. */
|
|
110
|
+
clientLoading: boolean;
|
|
111
|
+
/**Load the default Open Discord client initialization. */
|
|
112
|
+
clientInitiating: boolean;
|
|
113
|
+
/**Load the default Open Discord client ready actions (status, commands, permissions, ...). */
|
|
114
|
+
clientReady: boolean;
|
|
115
|
+
/**Create a warning when the bot is present in multiple guilds. */
|
|
116
|
+
clientMultiGuildWarning: boolean;
|
|
117
|
+
/**Load the default Open Discord client activity (from `config/general.json`). */
|
|
118
|
+
clientActivityLoading: boolean;
|
|
119
|
+
/**Load the default Open Discord client activity initialization (& status refresh). */
|
|
120
|
+
clientActivityInitiating: boolean;
|
|
121
|
+
/**Load the default Open Discord priority levels. */
|
|
122
|
+
priorityLoading: boolean;
|
|
123
|
+
/**Load the default Open Discord slash commands. */
|
|
124
|
+
slashCommandLoading: boolean;
|
|
125
|
+
/**Load the default Open Discord slash command registerer (register slash cmds in discord). */
|
|
126
|
+
slashCommandRegistering: boolean;
|
|
127
|
+
/**When enabled, the bot is forced to re-register all slash commands in the server. This can be used in case of a auto-update malfunction. */
|
|
128
|
+
forceSlashCommandRegistration: boolean;
|
|
129
|
+
/**When enabled, the bot is allowed to unregister all slash commands which aren't used in Open Discord. Disable this if you don't want to use the Open Discord `ODSlashCommand` classes. */
|
|
130
|
+
allowSlashCommandRemoval: boolean;
|
|
131
|
+
/**Load the default Open Discord context menus. */
|
|
132
|
+
contextMenuLoading: boolean;
|
|
133
|
+
/**Load the default Open Discord context menu registerer (register menus in discord). */
|
|
134
|
+
contextMenuRegistering: boolean;
|
|
135
|
+
/**When enabled, the bot is forced to re-register all context menus in the server. This can be used in case of a auto-update malfunction. */
|
|
136
|
+
forceContextMenuRegistration: boolean;
|
|
137
|
+
/**When enabled, the bot is allowed to unregister all context menus which aren't used in Open Discord. Disable this if you don't want to use the Open Discord `ODContextMenu` classes. */
|
|
138
|
+
allowContextMenuRemoval: boolean;
|
|
139
|
+
/**Load the default Open Discord text commands. */
|
|
140
|
+
textCommandLoading: boolean;
|
|
141
|
+
/**Load the default Open Discord button builders. */
|
|
142
|
+
buttonBuildersLoading: boolean;
|
|
143
|
+
/**Load the default Open Discord dropdown builders. */
|
|
144
|
+
dropdownBuildersLoading: boolean;
|
|
145
|
+
/**Load the default Open Discord file builders. */
|
|
146
|
+
fileBuildersLoading: boolean;
|
|
147
|
+
/**Load the default Open Discord embed builders. */
|
|
148
|
+
embedBuildersLoading: boolean;
|
|
149
|
+
/**Load the default Open Discord message builders. */
|
|
150
|
+
messageBuildersLoading: boolean;
|
|
151
|
+
/**Load the default Open Discord modal builders. */
|
|
152
|
+
modalBuildersLoading: boolean;
|
|
153
|
+
/**Load the default Open Discord command responders. */
|
|
154
|
+
commandRespondersLoading: boolean;
|
|
155
|
+
/**Load the default Open Discord button responders. */
|
|
156
|
+
buttonRespondersLoading: boolean;
|
|
157
|
+
/**Load the default Open Discord dropdown responders. */
|
|
158
|
+
dropdownRespondersLoading: boolean;
|
|
159
|
+
/**Load the default Open Discord modal responders. */
|
|
160
|
+
modalRespondersLoading: boolean;
|
|
161
|
+
/**Load the default Open Discord context menu responders. */
|
|
162
|
+
contextMenuRespondersLoading: boolean;
|
|
163
|
+
/**Load the default Open Discord autocomplete responders. */
|
|
164
|
+
autocompleteRespondersLoading: boolean;
|
|
165
|
+
/**Set the time (in ms) before Open Discord sends an error message when no reply is sent in a responder. */
|
|
166
|
+
responderTimeoutMs: number;
|
|
167
|
+
/**Load the default Open Discord actions. */
|
|
168
|
+
actionsLoading: boolean;
|
|
169
|
+
/**Load the default Open Discord verify bars. */
|
|
170
|
+
verifyBarsLoading: boolean;
|
|
171
|
+
/**Load the default Open Discord permissions. */
|
|
172
|
+
permissionsLoading: boolean;
|
|
173
|
+
/**Load the default Open Discord posts. */
|
|
174
|
+
postsLoading: boolean;
|
|
175
|
+
/**Initiate the default Open Discord posts. */
|
|
176
|
+
postsInitiating: boolean;
|
|
177
|
+
/**Load the default Open Discord cooldowns. */
|
|
178
|
+
cooldownsLoading: boolean;
|
|
179
|
+
/**Initiate the default Open Discord cooldowns. */
|
|
180
|
+
cooldownsInitiating: boolean;
|
|
181
|
+
/**Load the default Open Discord help menu categories. */
|
|
182
|
+
helpMenuCategoryLoading: boolean;
|
|
183
|
+
/**Load the default Open Discord help menu components. */
|
|
184
|
+
helpMenuComponentLoading: boolean;
|
|
185
|
+
/**Load the default Open Discord stat scopes. */
|
|
186
|
+
statScopesLoading: boolean;
|
|
187
|
+
/**Load the default Open Discord stats. */
|
|
188
|
+
statLoading: boolean;
|
|
189
|
+
/**Initiate the default Open Discord stats. */
|
|
190
|
+
statInitiating: boolean;
|
|
191
|
+
/**Load the default Open Discord code/functions. */
|
|
192
|
+
codeLoading: boolean;
|
|
193
|
+
/**Execute the default Open Discord code/functions. */
|
|
194
|
+
codeExecution: boolean;
|
|
195
|
+
/**Load the default Open Discord livestatus. */
|
|
196
|
+
liveStatusLoading: boolean;
|
|
197
|
+
/**Load the default Open Discord startscreen. */
|
|
198
|
+
startScreenLoading: boolean;
|
|
199
|
+
/**Render the default Open Discord startscreen. */
|
|
200
|
+
startScreenRendering: boolean;
|
|
201
|
+
/**Load the emoji style from the Open Discord general config. */
|
|
202
|
+
emojiTitleStyleLoading: boolean;
|
|
203
|
+
/**The emoji style to use in embed & message titles using `utilities.emoijTitle()` */
|
|
204
|
+
emojiTitleStyle: "disabled" | "before" | "after" | "double";
|
|
205
|
+
/**The emoji divider to use in embed & message titles using `utilities.emoijTitle()` */
|
|
206
|
+
emojiTitleDivider: string;
|
|
207
|
+
}
|
|
208
|
+
/**## ODFuseManager `class`
|
|
209
|
+
* This is an Open Discord fuse manager.
|
|
210
|
+
*
|
|
211
|
+
* It manages all settings in Open Discord that are not meant to be in the config.
|
|
212
|
+
* Here you can disable certain default features of the bot to replace them with your own implementation!
|
|
213
|
+
*
|
|
214
|
+
* You can think of them like real fuses, they disable an entire branch of the bot!
|
|
215
|
+
*/
|
|
216
|
+
export declare class ODSharedFuseManager extends ODFuseManager<ODSharedFuseList> {
|
|
217
|
+
constructor();
|
|
218
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
///////////////////////////////////////
|
|
3
|
+
//FUSE MODULE
|
|
4
|
+
///////////////////////////////////////
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ODSharedFuseManager = exports.ODFuseManager = void 0;
|
|
7
|
+
/**## ODFuseManager `class`
|
|
8
|
+
* This is an Open Discord fuse manager.
|
|
9
|
+
*
|
|
10
|
+
* It manages all settings in Open Discord that are not meant to be in the config.
|
|
11
|
+
* Here you can disable certain default features of the bot to replace them with your own implementation!
|
|
12
|
+
*
|
|
13
|
+
* You can think of them like real fuses, they disable an entire branch of the bot!
|
|
14
|
+
*/
|
|
15
|
+
class ODFuseManager {
|
|
16
|
+
/**A list of all the defaults */
|
|
17
|
+
fuses;
|
|
18
|
+
constructor(fuses) {
|
|
19
|
+
this.fuses = fuses;
|
|
20
|
+
}
|
|
21
|
+
/**Set a fuse to a specific value. Remember! All plugins can edit these values, so your value could be overwritten! */
|
|
22
|
+
setFuse(key, value) {
|
|
23
|
+
this.fuses[key] = value;
|
|
24
|
+
}
|
|
25
|
+
/**Get a fuse. Remember! All plugins can edit these values, so this value could be overwritten! */
|
|
26
|
+
getFuse(key) {
|
|
27
|
+
return this.fuses[key];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.ODFuseManager = ODFuseManager;
|
|
31
|
+
/**## ODFuseManager `class`
|
|
32
|
+
* This is an Open Discord fuse manager.
|
|
33
|
+
*
|
|
34
|
+
* It manages all settings in Open Discord that are not meant to be in the config.
|
|
35
|
+
* Here you can disable certain default features of the bot to replace them with your own implementation!
|
|
36
|
+
*
|
|
37
|
+
* You can think of them like real fuses, they disable an entire branch of the bot!
|
|
38
|
+
*/
|
|
39
|
+
class ODSharedFuseManager extends ODFuseManager {
|
|
40
|
+
constructor() {
|
|
41
|
+
super({
|
|
42
|
+
errorHandling: true,
|
|
43
|
+
crashOnError: false,
|
|
44
|
+
debugLoading: true,
|
|
45
|
+
silentLoading: true,
|
|
46
|
+
allowDumpCommand: true,
|
|
47
|
+
pluginLoading: true,
|
|
48
|
+
softPluginLoading: false,
|
|
49
|
+
pluginClassLoading: true,
|
|
50
|
+
flagLoading: true,
|
|
51
|
+
flagInitiating: true,
|
|
52
|
+
progressBarRendererLoading: true,
|
|
53
|
+
progressBarLoading: true,
|
|
54
|
+
configLoading: true,
|
|
55
|
+
configInitiating: true,
|
|
56
|
+
databaseLoading: true,
|
|
57
|
+
databaseInitiating: true,
|
|
58
|
+
sessionLoading: true,
|
|
59
|
+
languageLoading: true,
|
|
60
|
+
languageInitiating: true,
|
|
61
|
+
languageSelection: true,
|
|
62
|
+
backupLanguage: "opendiscord:english",
|
|
63
|
+
languageList: [],
|
|
64
|
+
checkerLoading: true,
|
|
65
|
+
checkerFunctionLoading: true,
|
|
66
|
+
checkerExecution: true,
|
|
67
|
+
checkerTranslationLoading: true,
|
|
68
|
+
checkerRendering: true,
|
|
69
|
+
checkerQuit: true,
|
|
70
|
+
checkerRenderEmpty: false,
|
|
71
|
+
clientLoading: true,
|
|
72
|
+
clientInitiating: true,
|
|
73
|
+
clientReady: true,
|
|
74
|
+
clientMultiGuildWarning: true,
|
|
75
|
+
clientActivityLoading: true,
|
|
76
|
+
clientActivityInitiating: true,
|
|
77
|
+
priorityLoading: true,
|
|
78
|
+
slashCommandLoading: true,
|
|
79
|
+
slashCommandRegistering: true,
|
|
80
|
+
forceSlashCommandRegistration: false,
|
|
81
|
+
allowSlashCommandRemoval: true,
|
|
82
|
+
contextMenuLoading: true,
|
|
83
|
+
contextMenuRegistering: true,
|
|
84
|
+
forceContextMenuRegistration: false,
|
|
85
|
+
allowContextMenuRemoval: true,
|
|
86
|
+
textCommandLoading: true,
|
|
87
|
+
buttonBuildersLoading: true,
|
|
88
|
+
dropdownBuildersLoading: true,
|
|
89
|
+
fileBuildersLoading: true,
|
|
90
|
+
embedBuildersLoading: true,
|
|
91
|
+
messageBuildersLoading: true,
|
|
92
|
+
modalBuildersLoading: true,
|
|
93
|
+
commandRespondersLoading: true,
|
|
94
|
+
buttonRespondersLoading: true,
|
|
95
|
+
dropdownRespondersLoading: true,
|
|
96
|
+
modalRespondersLoading: true,
|
|
97
|
+
contextMenuRespondersLoading: true,
|
|
98
|
+
autocompleteRespondersLoading: true,
|
|
99
|
+
responderTimeoutMs: 2500,
|
|
100
|
+
actionsLoading: true,
|
|
101
|
+
verifyBarsLoading: true,
|
|
102
|
+
permissionsLoading: true,
|
|
103
|
+
postsLoading: true,
|
|
104
|
+
postsInitiating: true,
|
|
105
|
+
cooldownsLoading: true,
|
|
106
|
+
cooldownsInitiating: true,
|
|
107
|
+
helpMenuCategoryLoading: true,
|
|
108
|
+
helpMenuComponentLoading: true,
|
|
109
|
+
statScopesLoading: true,
|
|
110
|
+
statLoading: true,
|
|
111
|
+
statInitiating: true,
|
|
112
|
+
codeLoading: true,
|
|
113
|
+
codeExecution: true,
|
|
114
|
+
liveStatusLoading: true,
|
|
115
|
+
startScreenLoading: true,
|
|
116
|
+
startScreenRendering: true,
|
|
117
|
+
emojiTitleStyleLoading: true,
|
|
118
|
+
emojiTitleStyle: "before",
|
|
119
|
+
emojiTitleDivider: " "
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
exports.ODSharedFuseManager = ODSharedFuseManager;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { ODId, ODManager, ODManagerData, ODValidId } from "./base";
|
|
2
|
+
import { ODDebugger } from "./console";
|
|
3
|
+
/**## ODHelpMenuComponentRenderer `type`
|
|
4
|
+
* This is the callback of the help menu component renderer. It also contains information about how & where it is rendered.
|
|
5
|
+
*/
|
|
6
|
+
export type ODHelpMenuComponentRenderer = (page: number, category: number, location: number, mode: "slash" | "text") => string | Promise<string>;
|
|
7
|
+
/**## ODHelpMenuComponent `class`
|
|
8
|
+
* This is an Open Discord help menu component.
|
|
9
|
+
*
|
|
10
|
+
* It can render something on the Open Discord help menu.
|
|
11
|
+
*/
|
|
12
|
+
export declare class ODHelpMenuComponent extends ODManagerData {
|
|
13
|
+
/**The priority of this component. The higher, the earlier it will appear in the help menu. */
|
|
14
|
+
priority: number;
|
|
15
|
+
/**The render function for this component. */
|
|
16
|
+
render: ODHelpMenuComponentRenderer;
|
|
17
|
+
constructor(id: ODValidId, priority: number, render: ODHelpMenuComponentRenderer);
|
|
18
|
+
}
|
|
19
|
+
/**## ODHelpMenuTextComponent `class`
|
|
20
|
+
* This is an Open Discord help menu text component.
|
|
21
|
+
*
|
|
22
|
+
* It can render a static piece of text on the Open Discord help menu.
|
|
23
|
+
*/
|
|
24
|
+
export declare class ODHelpMenuTextComponent extends ODHelpMenuComponent {
|
|
25
|
+
constructor(id: ODValidId, priority: number, text: string);
|
|
26
|
+
}
|
|
27
|
+
/**## ODHelpMenuCommandComponentOption `interface`
|
|
28
|
+
* This interface contains a command option for the `ODHelpMenuCommandComponent`.
|
|
29
|
+
*/
|
|
30
|
+
export interface ODHelpMenuCommandComponentOption {
|
|
31
|
+
/**The name of this option. */
|
|
32
|
+
name: string;
|
|
33
|
+
/**Is this option optional? */
|
|
34
|
+
optional: boolean;
|
|
35
|
+
}
|
|
36
|
+
/**## ODHelpMenuCommandComponentSettings `interface`
|
|
37
|
+
* This interface contains the settings for the `ODHelpMenuCommandComponent`.
|
|
38
|
+
*/
|
|
39
|
+
export interface ODHelpMenuCommandComponentSettings {
|
|
40
|
+
/**The name of this text command. */
|
|
41
|
+
textName?: string;
|
|
42
|
+
/**The name of this slash command. */
|
|
43
|
+
slashName?: string;
|
|
44
|
+
/**Options available in the text command. */
|
|
45
|
+
textOptions?: ODHelpMenuCommandComponentOption[];
|
|
46
|
+
/**Options available in the slash command. */
|
|
47
|
+
slashOptions?: ODHelpMenuCommandComponentOption[];
|
|
48
|
+
/**The description for the text command. */
|
|
49
|
+
textDescription?: string;
|
|
50
|
+
/**The description for the slash command. */
|
|
51
|
+
slashDescription?: string;
|
|
52
|
+
}
|
|
53
|
+
/**## ODHelpMenuCommandComponent `class`
|
|
54
|
+
* This is an Open Discord help menu command component.
|
|
55
|
+
*
|
|
56
|
+
* It contains a useful helper to render a command in the Open Discord help menu.
|
|
57
|
+
*/
|
|
58
|
+
export declare class ODHelpMenuCommandComponent extends ODHelpMenuComponent {
|
|
59
|
+
#private;
|
|
60
|
+
constructor(id: ODValidId, priority: number, settings: ODHelpMenuCommandComponentSettings);
|
|
61
|
+
}
|
|
62
|
+
/**## ODHelpMenuCategory `class`
|
|
63
|
+
* This is an Open Discord help menu category.
|
|
64
|
+
*
|
|
65
|
+
* Every category in the help menu is an embed field by default.
|
|
66
|
+
* Try to limit the amount of components per category.
|
|
67
|
+
*/
|
|
68
|
+
export declare class ODHelpMenuCategory extends ODManager<ODHelpMenuComponent> {
|
|
69
|
+
/**The id of this category. */
|
|
70
|
+
id: ODId;
|
|
71
|
+
/**The priority of this category. The higher, the earlier it will appear in the menu. */
|
|
72
|
+
priority: number;
|
|
73
|
+
/**The name of this category. (can include emoji's) */
|
|
74
|
+
name: string;
|
|
75
|
+
/**When enabled, it automatically starts this category on a new page. */
|
|
76
|
+
newPage: boolean;
|
|
77
|
+
constructor(id: ODValidId, priority: number, name: string, newPage?: boolean);
|
|
78
|
+
/**Render this category and it's components. */
|
|
79
|
+
render(page: number, category: number, mode: "slash" | "text"): Promise<string>;
|
|
80
|
+
}
|
|
81
|
+
/**## ODHelpMenuRenderResult `type`
|
|
82
|
+
* This is the array returned when the help menu has been rendered successfully.
|
|
83
|
+
*
|
|
84
|
+
* It contains a list of pages, which contain categories by name & value (content).
|
|
85
|
+
*/
|
|
86
|
+
export type ODHelpMenuRenderResult = {
|
|
87
|
+
name: string;
|
|
88
|
+
value: string;
|
|
89
|
+
}[][];
|
|
90
|
+
/**## ODHelpMenuManager `class`
|
|
91
|
+
* This is an Open Discord help menu manager.
|
|
92
|
+
*
|
|
93
|
+
* It is responsible for rendering the entire help menu content.
|
|
94
|
+
* You are also able to configure the amount of categories per page here.
|
|
95
|
+
*
|
|
96
|
+
* Fewer Categories == More Clean Menu
|
|
97
|
+
*/
|
|
98
|
+
export declare class ODHelpMenuManager extends ODManager<ODHelpMenuCategory> {
|
|
99
|
+
#private;
|
|
100
|
+
/**The amount of categories per-page. */
|
|
101
|
+
categoriesPerPage: number;
|
|
102
|
+
constructor(debug: ODDebugger);
|
|
103
|
+
add(data: ODHelpMenuCategory, overwrite?: boolean): boolean;
|
|
104
|
+
/**Render this entire help menu & return a `ODHelpMenuRenderResult`. */
|
|
105
|
+
render(mode: "slash" | "text"): Promise<ODHelpMenuRenderResult>;
|
|
106
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ODHelpMenuManager = exports.ODHelpMenuCategory = exports.ODHelpMenuCommandComponent = exports.ODHelpMenuTextComponent = exports.ODHelpMenuComponent = void 0;
|
|
4
|
+
///////////////////////////////////////
|
|
5
|
+
//HELP MODULE
|
|
6
|
+
///////////////////////////////////////
|
|
7
|
+
const base_1 = require("./base");
|
|
8
|
+
/**## ODHelpMenuComponent `class`
|
|
9
|
+
* This is an Open Discord help menu component.
|
|
10
|
+
*
|
|
11
|
+
* It can render something on the Open Discord help menu.
|
|
12
|
+
*/
|
|
13
|
+
class ODHelpMenuComponent extends base_1.ODManagerData {
|
|
14
|
+
/**The priority of this component. The higher, the earlier it will appear in the help menu. */
|
|
15
|
+
priority;
|
|
16
|
+
/**The render function for this component. */
|
|
17
|
+
render;
|
|
18
|
+
constructor(id, priority, render) {
|
|
19
|
+
super(id);
|
|
20
|
+
this.priority = priority;
|
|
21
|
+
this.render = render;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.ODHelpMenuComponent = ODHelpMenuComponent;
|
|
25
|
+
/**## ODHelpMenuTextComponent `class`
|
|
26
|
+
* This is an Open Discord help menu text component.
|
|
27
|
+
*
|
|
28
|
+
* It can render a static piece of text on the Open Discord help menu.
|
|
29
|
+
*/
|
|
30
|
+
class ODHelpMenuTextComponent extends ODHelpMenuComponent {
|
|
31
|
+
constructor(id, priority, text) {
|
|
32
|
+
super(id, priority, () => {
|
|
33
|
+
return text;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.ODHelpMenuTextComponent = ODHelpMenuTextComponent;
|
|
38
|
+
/**## ODHelpMenuCommandComponent `class`
|
|
39
|
+
* This is an Open Discord help menu command component.
|
|
40
|
+
*
|
|
41
|
+
* It contains a useful helper to render a command in the Open Discord help menu.
|
|
42
|
+
*/
|
|
43
|
+
class ODHelpMenuCommandComponent extends ODHelpMenuComponent {
|
|
44
|
+
constructor(id, priority, settings) {
|
|
45
|
+
super(id, priority, (page, category, location, mode) => {
|
|
46
|
+
if (mode == "slash" && settings.slashName) {
|
|
47
|
+
return `\`${settings.slashName}${(settings.slashOptions) ? this.#renderOptions(settings.slashOptions) : ""}\` ➜ ${settings.slashDescription ?? ""}`;
|
|
48
|
+
}
|
|
49
|
+
else if (mode == "text" && settings.textName) {
|
|
50
|
+
return `\`${settings.textName}${(settings.textOptions) ? this.#renderOptions(settings.textOptions) : ""}\` ➜ ${settings.textDescription ?? ""}`;
|
|
51
|
+
}
|
|
52
|
+
else
|
|
53
|
+
return "";
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**Utility function to render all command options. */
|
|
57
|
+
#renderOptions(options) {
|
|
58
|
+
return " " + options.map((opt) => (opt.optional) ? `[${opt.name}]` : `<${opt.name}>`).join(" ");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.ODHelpMenuCommandComponent = ODHelpMenuCommandComponent;
|
|
62
|
+
/**## ODHelpMenuCategory `class`
|
|
63
|
+
* This is an Open Discord help menu category.
|
|
64
|
+
*
|
|
65
|
+
* Every category in the help menu is an embed field by default.
|
|
66
|
+
* Try to limit the amount of components per category.
|
|
67
|
+
*/
|
|
68
|
+
class ODHelpMenuCategory extends base_1.ODManager {
|
|
69
|
+
/**The id of this category. */
|
|
70
|
+
id;
|
|
71
|
+
/**The priority of this category. The higher, the earlier it will appear in the menu. */
|
|
72
|
+
priority;
|
|
73
|
+
/**The name of this category. (can include emoji's) */
|
|
74
|
+
name;
|
|
75
|
+
/**When enabled, it automatically starts this category on a new page. */
|
|
76
|
+
newPage;
|
|
77
|
+
constructor(id, priority, name, newPage) {
|
|
78
|
+
super();
|
|
79
|
+
this.id = new base_1.ODId(id);
|
|
80
|
+
this.priority = priority;
|
|
81
|
+
this.name = name;
|
|
82
|
+
this.newPage = newPage ?? false;
|
|
83
|
+
}
|
|
84
|
+
/**Render this category and it's components. */
|
|
85
|
+
async render(page, category, mode) {
|
|
86
|
+
//sort from high priority to low
|
|
87
|
+
const derefArray = [...this.getAll()];
|
|
88
|
+
derefArray.sort((a, b) => {
|
|
89
|
+
return b.priority - a.priority;
|
|
90
|
+
});
|
|
91
|
+
const result = [];
|
|
92
|
+
let i = 0;
|
|
93
|
+
for (const component of derefArray) {
|
|
94
|
+
try {
|
|
95
|
+
result.push(await component.render(page, category, i, mode));
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
process.emit("uncaughtException", err);
|
|
99
|
+
}
|
|
100
|
+
i++;
|
|
101
|
+
}
|
|
102
|
+
//only return the non-empty components
|
|
103
|
+
return result.filter((component) => component !== "").join("\n\n");
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.ODHelpMenuCategory = ODHelpMenuCategory;
|
|
107
|
+
/**## ODHelpMenuManager `class`
|
|
108
|
+
* This is an Open Discord help menu manager.
|
|
109
|
+
*
|
|
110
|
+
* It is responsible for rendering the entire help menu content.
|
|
111
|
+
* You are also able to configure the amount of categories per page here.
|
|
112
|
+
*
|
|
113
|
+
* Fewer Categories == More Clean Menu
|
|
114
|
+
*/
|
|
115
|
+
class ODHelpMenuManager extends base_1.ODManager {
|
|
116
|
+
/**Alias to Open Discord debugger. */
|
|
117
|
+
#debug;
|
|
118
|
+
/**The amount of categories per-page. */
|
|
119
|
+
categoriesPerPage = 3;
|
|
120
|
+
constructor(debug) {
|
|
121
|
+
super(debug, "help menu category");
|
|
122
|
+
this.#debug = debug;
|
|
123
|
+
}
|
|
124
|
+
add(data, overwrite) {
|
|
125
|
+
data.useDebug(this.#debug, "help menu component");
|
|
126
|
+
return super.add(data, overwrite);
|
|
127
|
+
}
|
|
128
|
+
/**Render this entire help menu & return a `ODHelpMenuRenderResult`. */
|
|
129
|
+
async render(mode) {
|
|
130
|
+
//sort from high priority to low
|
|
131
|
+
const derefArray = [...this.getAll()];
|
|
132
|
+
derefArray.sort((a, b) => {
|
|
133
|
+
return b.priority - a.priority;
|
|
134
|
+
});
|
|
135
|
+
const result = [];
|
|
136
|
+
let currentPage = [];
|
|
137
|
+
for (const category of derefArray) {
|
|
138
|
+
try {
|
|
139
|
+
const renderedCategory = await category.render(result.length, currentPage.length, mode);
|
|
140
|
+
if (renderedCategory !== "") {
|
|
141
|
+
//create new page when category wants to
|
|
142
|
+
if (currentPage.length > 0 && category.newPage) {
|
|
143
|
+
result.push(currentPage);
|
|
144
|
+
currentPage = [];
|
|
145
|
+
}
|
|
146
|
+
currentPage.push({
|
|
147
|
+
name: category.name,
|
|
148
|
+
value: renderedCategory
|
|
149
|
+
});
|
|
150
|
+
//create new page when page is full
|
|
151
|
+
if (currentPage.length >= this.categoriesPerPage) {
|
|
152
|
+
result.push(currentPage);
|
|
153
|
+
currentPage = [];
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
catch (err) {
|
|
158
|
+
process.emit("uncaughtException", err);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
//push current page when not-empty
|
|
162
|
+
if (currentPage.length > 0)
|
|
163
|
+
result.push(currentPage);
|
|
164
|
+
return result;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
exports.ODHelpMenuManager = ODHelpMenuManager;
|