@open-discord-bots/framework 0.2.11 → 0.2.13
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/dist/api/index.d.ts +26 -26
- package/dist/api/index.js +26 -42
- package/dist/api/main.d.ts +24 -24
- package/dist/api/main.js +7 -11
- package/dist/api/modules/action.d.ts +12 -12
- package/dist/api/modules/action.js +11 -17
- package/dist/api/modules/base.d.ts +7 -5
- package/dist/api/modules/base.js +22 -67
- package/dist/api/modules/builder.d.ts +44 -44
- package/dist/api/modules/builder.js +81 -142
- package/dist/api/modules/checker.d.ts +7 -7
- package/dist/api/modules/checker.js +55 -87
- package/dist/api/modules/client.d.ts +4 -4
- package/dist/api/modules/client.js +71 -118
- package/dist/api/modules/code.d.ts +2 -2
- package/dist/api/modules/code.js +3 -8
- package/dist/api/modules/config.d.ts +2 -2
- package/dist/api/modules/config.js +21 -63
- package/dist/api/modules/console.d.ts +16 -16
- package/dist/api/modules/console.js +61 -83
- package/dist/api/modules/cooldown.d.ts +2 -2
- package/dist/api/modules/cooldown.js +13 -23
- package/dist/api/modules/database.d.ts +2 -2
- package/dist/api/modules/database.js +19 -29
- package/dist/api/modules/event.d.ts +2 -2
- package/dist/api/modules/event.js +6 -11
- package/dist/api/modules/flag.d.ts +2 -2
- package/dist/api/modules/flag.js +3 -8
- package/dist/api/modules/fuse.js +2 -7
- package/dist/api/modules/helpmenu.d.ts +2 -2
- package/dist/api/modules/helpmenu.js +8 -16
- package/dist/api/modules/language.d.ts +2 -2
- package/dist/api/modules/language.js +12 -21
- package/dist/api/modules/permission.d.ts +3 -3
- package/dist/api/modules/permission.js +9 -47
- package/dist/api/modules/plugin.d.ts +2 -2
- package/dist/api/modules/plugin.js +9 -18
- package/dist/api/modules/post.d.ts +3 -3
- package/dist/api/modules/post.js +3 -8
- package/dist/api/modules/progressbar.d.ts +2 -2
- package/dist/api/modules/progressbar.js +14 -26
- package/dist/api/modules/responder.d.ts +42 -42
- package/dist/api/modules/responder.js +79 -138
- package/dist/api/modules/session.d.ts +2 -2
- package/dist/api/modules/session.js +4 -42
- package/dist/api/modules/startscreen.d.ts +4 -4
- package/dist/api/modules/startscreen.js +28 -44
- package/dist/api/modules/statistic.d.ts +3 -3
- package/dist/api/modules/statistic.js +11 -22
- package/dist/api/modules/verifybar.d.ts +5 -5
- package/dist/api/modules/verifybar.js +6 -11
- package/dist/api/modules/worker.d.ts +15 -15
- package/dist/api/modules/worker.js +12 -17
- package/dist/cli/editConfig.d.ts +2 -2
- package/dist/cli/editConfig.js +194 -248
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.js +37 -62
- package/dist/index.d.ts +4 -4
- package/dist/index.js +6 -13
- package/dist/startup/compilation.d.ts +1 -1
- package/dist/startup/compilation.js +35 -42
- package/dist/startup/dump.d.ts +1 -1
- package/dist/startup/dump.js +4 -41
- package/dist/startup/errorHandling.d.ts +1 -1
- package/dist/startup/errorHandling.js +2 -38
- package/dist/startup/pluginLauncher.d.ts +1 -1
- package/dist/startup/pluginLauncher.js +14 -52
- package/dist/utilities/index.d.ts +3 -3
- package/dist/utilities/index.js +20 -71
- package/package.json +5 -4
- package/src/api/index.ts +26 -26
- package/src/api/main.ts +25 -25
- package/src/api/modules/action.ts +13 -13
- package/src/api/modules/base.ts +14 -10
- package/src/api/modules/builder.ts +56 -56
- package/src/api/modules/checker.ts +7 -7
- package/src/api/modules/client.ts +18 -18
- package/src/api/modules/code.ts +2 -2
- package/src/api/modules/component.txt +350 -0
- package/src/api/modules/config.ts +3 -3
- package/src/api/modules/console.ts +28 -28
- package/src/api/modules/cooldown.ts +2 -2
- package/src/api/modules/database.ts +3 -3
- package/src/api/modules/event.ts +5 -5
- package/src/api/modules/flag.ts +2 -2
- package/src/api/modules/helpmenu.ts +4 -4
- package/src/api/modules/language.ts +3 -3
- package/src/api/modules/permission.ts +3 -3
- package/src/api/modules/plugin.ts +4 -4
- package/src/api/modules/post.ts +3 -3
- package/src/api/modules/progressbar.ts +5 -3
- package/src/api/modules/responder.ts +48 -48
- package/src/api/modules/session.ts +2 -2
- package/src/api/modules/startscreen.ts +4 -4
- package/src/api/modules/statistic.ts +3 -4
- package/src/api/modules/verifybar.ts +5 -5
- package/src/api/modules/worker.ts +25 -25
- package/src/cli/editConfig.ts +23 -37
- package/src/cli/index.ts +3 -3
- package/src/index.ts +5 -5
- package/src/startup/compilation.ts +2 -2
- package/src/startup/dump.ts +2 -2
- package/src/startup/errorHandling.ts +2 -2
- package/src/startup/pluginLauncher.ts +11 -8
- package/src/utilities/index.ts +4 -4
- package/tools/cleanup.js +1 -1
- package/tsconfig.json +2 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
///////////////////////////////////////
|
|
2
2
|
//BUILDER MODULE
|
|
3
3
|
///////////////////////////////////////
|
|
4
|
-
import { ODId, ODValidButtonColor, ODValidId, ODSystemError, ODInterfaceWithPartialProperty, ODManagerWithSafety, ODManagerData, ODNoGeneric } from "./base"
|
|
4
|
+
import { ODId, ODValidButtonColor, ODValidId, ODSystemError, ODInterfaceWithPartialProperty, ODManagerWithSafety, ODManagerData, ODNoGeneric } from "./base.js"
|
|
5
5
|
import * as discord from "discord.js"
|
|
6
|
-
import { ODWorkerManager, ODWorkerCallback, ODWorker } from "./worker"
|
|
7
|
-
import { ODDebugger } from "./console"
|
|
6
|
+
import { ODWorkerManager, ODWorkerCallback, ODWorker } from "./worker.js"
|
|
7
|
+
import { ODDebugger } from "./console.js"
|
|
8
8
|
|
|
9
9
|
/**## ODBuilderImplementation `class`
|
|
10
10
|
* This is an Open Discord builder implementation.
|
|
@@ -13,9 +13,9 @@ import { ODDebugger } from "./console"
|
|
|
13
13
|
*
|
|
14
14
|
* This class can't be used stand-alone & needs to be extended from!
|
|
15
15
|
*/
|
|
16
|
-
export class ODBuilderImplementation<Instance,
|
|
16
|
+
export class ODBuilderImplementation<Instance,Origin extends string,Params,BuildType extends {id:ODId},WorkerIds extends string = string> extends ODManagerData {
|
|
17
17
|
/**The manager that has all workers of this implementation */
|
|
18
|
-
workers: ODWorkerManager<Instance,
|
|
18
|
+
workers: ODWorkerManager<Instance,Origin,Params,WorkerIds>
|
|
19
19
|
/**Cache a build or create it every time from scratch when this.build() gets executed. */
|
|
20
20
|
allowCache: boolean = false
|
|
21
21
|
/**Did the build already got created/cached? */
|
|
@@ -23,7 +23,7 @@ export class ODBuilderImplementation<Instance,Source extends string,Params,Build
|
|
|
23
23
|
/**The cache of this build. */
|
|
24
24
|
cache:BuildType|null = null
|
|
25
25
|
|
|
26
|
-
constructor(id:ODValidId, callback?:ODWorkerCallback<Instance,
|
|
26
|
+
constructor(id:ODValidId, callback?:ODWorkerCallback<Instance,Origin,Params>, priority?:number, callbackId?:ODValidId){
|
|
27
27
|
super(id)
|
|
28
28
|
this.workers = new ODWorkerManager("ascending")
|
|
29
29
|
if (callback) this.workers.add(new ODWorker(callbackId ? callbackId : id,priority ?? 0,callback))
|
|
@@ -42,7 +42,7 @@ export class ODBuilderImplementation<Instance,Source extends string,Params,Build
|
|
|
42
42
|
return this
|
|
43
43
|
}
|
|
44
44
|
/**Execute all workers & return the result. */
|
|
45
|
-
async build(
|
|
45
|
+
async build(origin:Origin, params:Params): Promise<BuildType> {
|
|
46
46
|
throw new ODSystemError("Tried to build an unimplemented ODBuilderImplementation")
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -58,7 +58,7 @@ export class ODBuilderImplementation<Instance,Source extends string,Params,Build
|
|
|
58
58
|
* - independent workers (with priority)
|
|
59
59
|
* - fail-safe design using try-catch
|
|
60
60
|
* - cache frequently used objects
|
|
61
|
-
* - get to know the
|
|
61
|
+
* - get to know the origin of the build request for a specific message, button, etc
|
|
62
62
|
* - And so much more!
|
|
63
63
|
*/
|
|
64
64
|
export class ODBuilderManager<
|
|
@@ -105,7 +105,7 @@ export interface ODComponentBuildResult {
|
|
|
105
105
|
/**## ODButtonManagerIdConstraint `type`
|
|
106
106
|
* The constraint/layout for id mappings/interfaces of the `ODButtonManager` class.
|
|
107
107
|
*/
|
|
108
|
-
export type ODButtonManagerIdConstraint = Record<string,{
|
|
108
|
+
export type ODButtonManagerIdConstraint = Record<string,{origin:string,params:object,workers:string}>
|
|
109
109
|
|
|
110
110
|
/**## ODButtonManager `class`
|
|
111
111
|
* This is an Open Discord button manager.
|
|
@@ -117,7 +117,7 @@ export type ODButtonManagerIdConstraint = Record<string,{source:string,params:ob
|
|
|
117
117
|
export class ODButtonManager<IdList extends ODButtonManagerIdConstraint = ODButtonManagerIdConstraint> extends ODManagerWithSafety<ODButton<string,{},string>> {
|
|
118
118
|
constructor(debug:ODDebugger){
|
|
119
119
|
super(() => {
|
|
120
|
-
return new ODButton("opendiscord:unknown-button",(instance,params,
|
|
120
|
+
return new ODButton("opendiscord:unknown-button",(instance,params,origin,cancel) => {
|
|
121
121
|
instance.setCustomId("od:unknown-button")
|
|
122
122
|
instance.setMode("button")
|
|
123
123
|
instance.setColor("red")
|
|
@@ -137,14 +137,14 @@ export class ODButtonManager<IdList extends ODButtonManagerIdConstraint = ODButt
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
get<ButtonId extends keyof ODNoGeneric<IdList>>(id:ButtonId): ODButton<IdList[ButtonId]["
|
|
140
|
+
get<ButtonId extends keyof ODNoGeneric<IdList>>(id:ButtonId): ODButton<IdList[ButtonId]["origin"],IdList[ButtonId]["params"],IdList[ButtonId]["workers"]>
|
|
141
141
|
get(id:ODValidId): ODButton<string,{},string>|null
|
|
142
142
|
|
|
143
143
|
get(id:ODValidId): ODButton<string,{},string>|null {
|
|
144
144
|
return super.get(id)
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
remove<ButtonId extends keyof ODNoGeneric<IdList>>(id:ButtonId): ODButton<IdList[ButtonId]["
|
|
147
|
+
remove<ButtonId extends keyof ODNoGeneric<IdList>>(id:ButtonId): ODButton<IdList[ButtonId]["origin"],IdList[ButtonId]["params"],IdList[ButtonId]["workers"]>
|
|
148
148
|
remove(id:ODValidId): ODButton<string,{},string>|null
|
|
149
149
|
|
|
150
150
|
remove(id:ODValidId): ODButton<string,{},string>|null {
|
|
@@ -158,7 +158,7 @@ export class ODButtonManager<IdList extends ODButtonManagerIdConstraint = ODButt
|
|
|
158
158
|
return super.exists(id)
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
getSafe<ButtonId extends keyof ODNoGeneric<IdList>>(id:ButtonId): ODButton<IdList[ButtonId]["
|
|
161
|
+
getSafe<ButtonId extends keyof ODNoGeneric<IdList>>(id:ButtonId): ODButton<IdList[ButtonId]["origin"],IdList[ButtonId]["params"],IdList[ButtonId]["workers"]>
|
|
162
162
|
getSafe(id:ODValidId): ODButton<string,{},string>
|
|
163
163
|
|
|
164
164
|
getSafe(id:ODValidId): ODButton<string,{},string> {
|
|
@@ -248,9 +248,9 @@ export class ODButtonInstance {
|
|
|
248
248
|
*
|
|
249
249
|
* This is possible by using "workers" or multiple functions that will be executed in priority order!
|
|
250
250
|
*/
|
|
251
|
-
export class ODButton<
|
|
251
|
+
export class ODButton<Origin extends string,Params,WorkerIds extends string = string> extends ODBuilderImplementation<ODButtonInstance,Origin,Params,ODComponentBuildResult,WorkerIds> {
|
|
252
252
|
/**Build this button & compile it for discord.js */
|
|
253
|
-
async build(
|
|
253
|
+
async build(origin:Origin, params:Params): Promise<ODComponentBuildResult> {
|
|
254
254
|
if (this.didCache && this.cache && this.allowCache) return this.cache
|
|
255
255
|
|
|
256
256
|
try {
|
|
@@ -258,7 +258,7 @@ export class ODButton<Source extends string,Params,WorkerIds extends string = st
|
|
|
258
258
|
const instance = new ODButtonInstance()
|
|
259
259
|
|
|
260
260
|
//wait for workers to finish
|
|
261
|
-
await this.workers.executeWorkers(instance,
|
|
261
|
+
await this.workers.executeWorkers(instance,origin,params)
|
|
262
262
|
|
|
263
263
|
//create the discord.js button
|
|
264
264
|
const button = new discord.ButtonBuilder()
|
|
@@ -334,7 +334,7 @@ export class ODQuickButton {
|
|
|
334
334
|
/**## ODDropdownManagerIdConstraint `type`
|
|
335
335
|
* The constraint/layout for id mappings/interfaces of the `ODDropdownManager` class.
|
|
336
336
|
*/
|
|
337
|
-
export type ODDropdownManagerIdConstraint = Record<string,{
|
|
337
|
+
export type ODDropdownManagerIdConstraint = Record<string,{origin:string,params:object,workers:string}>
|
|
338
338
|
|
|
339
339
|
/**## ODDropdownManager `class`
|
|
340
340
|
* This is an Open Discord dropdown manager.
|
|
@@ -346,7 +346,7 @@ export type ODDropdownManagerIdConstraint = Record<string,{source:string,params:
|
|
|
346
346
|
export class ODDropdownManager<IdList extends ODDropdownManagerIdConstraint = ODDropdownManagerIdConstraint> extends ODManagerWithSafety<ODDropdown<string,{},string>> {
|
|
347
347
|
constructor(debug:ODDebugger){
|
|
348
348
|
super(() => {
|
|
349
|
-
return new ODDropdown("opendiscord:unknown-dropdown",(instance,params,
|
|
349
|
+
return new ODDropdown("opendiscord:unknown-dropdown",(instance,params,origin,cancel) => {
|
|
350
350
|
instance.setCustomId("od:unknown-dropdown")
|
|
351
351
|
instance.setType("string")
|
|
352
352
|
instance.setPlaceholder("❌ <ODError:Unknown Dropdown>")
|
|
@@ -367,14 +367,14 @@ export class ODDropdownManager<IdList extends ODDropdownManagerIdConstraint = OD
|
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
369
|
|
|
370
|
-
get<DropdownId extends keyof ODNoGeneric<IdList>>(id:DropdownId): ODDropdown<IdList[DropdownId]["
|
|
370
|
+
get<DropdownId extends keyof ODNoGeneric<IdList>>(id:DropdownId): ODDropdown<IdList[DropdownId]["origin"],IdList[DropdownId]["params"],IdList[DropdownId]["workers"]>
|
|
371
371
|
get(id:ODValidId): ODDropdown<string,{},string>|null
|
|
372
372
|
|
|
373
373
|
get(id:ODValidId): ODDropdown<string,{},string>|null {
|
|
374
374
|
return super.get(id)
|
|
375
375
|
}
|
|
376
376
|
|
|
377
|
-
remove<DropdownId extends keyof ODNoGeneric<IdList>>(id:DropdownId): ODDropdown<IdList[DropdownId]["
|
|
377
|
+
remove<DropdownId extends keyof ODNoGeneric<IdList>>(id:DropdownId): ODDropdown<IdList[DropdownId]["origin"],IdList[DropdownId]["params"],IdList[DropdownId]["workers"]>
|
|
378
378
|
remove(id:ODValidId): ODDropdown<string,{},string>|null
|
|
379
379
|
|
|
380
380
|
remove(id:ODValidId): ODDropdown<string,{},string>|null {
|
|
@@ -388,7 +388,7 @@ export class ODDropdownManager<IdList extends ODDropdownManagerIdConstraint = OD
|
|
|
388
388
|
return super.exists(id)
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
-
getSafe<DropdownId extends keyof ODNoGeneric<IdList>>(id:DropdownId): ODDropdown<IdList[DropdownId]["
|
|
391
|
+
getSafe<DropdownId extends keyof ODNoGeneric<IdList>>(id:DropdownId): ODDropdown<IdList[DropdownId]["origin"],IdList[DropdownId]["params"],IdList[DropdownId]["workers"]>
|
|
392
392
|
getSafe(id:ODValidId): ODDropdown<string,{},string>
|
|
393
393
|
|
|
394
394
|
getSafe(id:ODValidId): ODDropdown<string,{},string> {
|
|
@@ -520,9 +520,9 @@ export class ODDropdownInstance {
|
|
|
520
520
|
*
|
|
521
521
|
* This is possible by using "workers" or multiple functions that will be executed in priority order!
|
|
522
522
|
*/
|
|
523
|
-
export class ODDropdown<
|
|
523
|
+
export class ODDropdown<Origin extends string,Params,WorkerIds extends string = string> extends ODBuilderImplementation<ODDropdownInstance,Origin,Params,ODComponentBuildResult,WorkerIds> {
|
|
524
524
|
/**Build this dropdown & compile it for discord.js */
|
|
525
|
-
async build(
|
|
525
|
+
async build(origin:Origin, params:Params): Promise<ODComponentBuildResult> {
|
|
526
526
|
if (this.didCache && this.cache && this.allowCache) return this.cache
|
|
527
527
|
|
|
528
528
|
try{
|
|
@@ -530,7 +530,7 @@ export class ODDropdown<Source extends string,Params,WorkerIds extends string =
|
|
|
530
530
|
const instance = new ODDropdownInstance()
|
|
531
531
|
|
|
532
532
|
//wait for workers to finish
|
|
533
|
-
await this.workers.executeWorkers(instance,
|
|
533
|
+
await this.workers.executeWorkers(instance,origin,params)
|
|
534
534
|
|
|
535
535
|
//create the discord.js dropdown
|
|
536
536
|
if (instance.data.type == "string"){
|
|
@@ -724,7 +724,7 @@ export class ODQuickDropdown {
|
|
|
724
724
|
/**## ODFileManagerIdConstraint `type`
|
|
725
725
|
* The constraint/layout for id mappings/interfaces of the `ODFileManager` class.
|
|
726
726
|
*/
|
|
727
|
-
export type ODFileManagerIdConstraint = Record<string,{
|
|
727
|
+
export type ODFileManagerIdConstraint = Record<string,{origin:string,params:object,workers:string}>
|
|
728
728
|
|
|
729
729
|
/**## ODFileManager `class`
|
|
730
730
|
* This is an Open Discord file manager.
|
|
@@ -736,7 +736,7 @@ export type ODFileManagerIdConstraint = Record<string,{source:string,params:obje
|
|
|
736
736
|
export class ODFileManager<IdList extends ODFileManagerIdConstraint = ODFileManagerIdConstraint> extends ODManagerWithSafety<ODFile<string,{},string>> {
|
|
737
737
|
constructor(debug:ODDebugger){
|
|
738
738
|
super(() => {
|
|
739
|
-
return new ODFile("opendiscord:unknown-file",(instance,params,
|
|
739
|
+
return new ODFile("opendiscord:unknown-file",(instance,params,origin,cancel) => {
|
|
740
740
|
instance.setName("opendiscord_unknown-file.txt")
|
|
741
741
|
instance.setDescription("❌ <ODError:Unknown File>")
|
|
742
742
|
instance.setContents("Couldn't find file in registery `opendiscord.builders.files`")
|
|
@@ -745,14 +745,14 @@ export class ODFileManager<IdList extends ODFileManagerIdConstraint = ODFileMana
|
|
|
745
745
|
},debug,"file")
|
|
746
746
|
}
|
|
747
747
|
|
|
748
|
-
get<FileId extends keyof ODNoGeneric<IdList>>(id:FileId): ODFile<IdList[FileId]["
|
|
748
|
+
get<FileId extends keyof ODNoGeneric<IdList>>(id:FileId): ODFile<IdList[FileId]["origin"],IdList[FileId]["params"],IdList[FileId]["workers"]>
|
|
749
749
|
get(id:ODValidId): ODFile<string,{},string>|null
|
|
750
750
|
|
|
751
751
|
get(id:ODValidId): ODFile<string,{},string>|null {
|
|
752
752
|
return super.get(id)
|
|
753
753
|
}
|
|
754
754
|
|
|
755
|
-
remove<FileId extends keyof ODNoGeneric<IdList>>(id:FileId): ODFile<IdList[FileId]["
|
|
755
|
+
remove<FileId extends keyof ODNoGeneric<IdList>>(id:FileId): ODFile<IdList[FileId]["origin"],IdList[FileId]["params"],IdList[FileId]["workers"]>
|
|
756
756
|
remove(id:ODValidId): ODFile<string,{},string>|null
|
|
757
757
|
|
|
758
758
|
remove(id:ODValidId): ODFile<string,{},string>|null {
|
|
@@ -766,7 +766,7 @@ export class ODFileManager<IdList extends ODFileManagerIdConstraint = ODFileMana
|
|
|
766
766
|
return super.exists(id)
|
|
767
767
|
}
|
|
768
768
|
|
|
769
|
-
getSafe<FileId extends keyof ODNoGeneric<IdList>>(id:FileId): ODFile<IdList[FileId]["
|
|
769
|
+
getSafe<FileId extends keyof ODNoGeneric<IdList>>(id:FileId): ODFile<IdList[FileId]["origin"],IdList[FileId]["params"],IdList[FileId]["workers"]>
|
|
770
770
|
getSafe(id:ODValidId): ODFile<string,{},string>
|
|
771
771
|
|
|
772
772
|
getSafe(id:ODValidId): ODFile<string,{},string> {
|
|
@@ -847,9 +847,9 @@ export class ODFileInstance {
|
|
|
847
847
|
*
|
|
848
848
|
* This is possible by using "workers" or multiple functions that will be executed in priority order!
|
|
849
849
|
*/
|
|
850
|
-
export class ODFile<
|
|
850
|
+
export class ODFile<Origin extends string,Params,WorkerIds extends string = string> extends ODBuilderImplementation<ODFileInstance,Origin,Params,ODFileBuildResult,WorkerIds> {
|
|
851
851
|
/**Build this attachment & compile it for discord.js */
|
|
852
|
-
async build(
|
|
852
|
+
async build(origin:Origin, params:Params): Promise<ODFileBuildResult> {
|
|
853
853
|
if (this.didCache && this.cache && this.allowCache) return this.cache
|
|
854
854
|
|
|
855
855
|
try{
|
|
@@ -857,7 +857,7 @@ export class ODFile<Source extends string,Params,WorkerIds extends string = stri
|
|
|
857
857
|
const instance = new ODFileInstance()
|
|
858
858
|
|
|
859
859
|
//wait for workers to finish
|
|
860
|
-
await this.workers.executeWorkers(instance,
|
|
860
|
+
await this.workers.executeWorkers(instance,origin,params)
|
|
861
861
|
|
|
862
862
|
//create the discord.js attachment
|
|
863
863
|
const file = new discord.AttachmentBuilder(instance.data.file)
|
|
@@ -917,7 +917,7 @@ export class ODQuickFile {
|
|
|
917
917
|
/**## ODEmbedManagerIdConstraint `type`
|
|
918
918
|
* The constraint/layout for id mappings/interfaces of the `ODEmbedManager` class.
|
|
919
919
|
*/
|
|
920
|
-
export type ODEmbedManagerIdConstraint = Record<string,{
|
|
920
|
+
export type ODEmbedManagerIdConstraint = Record<string,{origin:string,params:object,workers:string}>
|
|
921
921
|
|
|
922
922
|
/**## ODEmbedManager `class`
|
|
923
923
|
* This is an Open Discord embed manager.
|
|
@@ -929,7 +929,7 @@ export type ODEmbedManagerIdConstraint = Record<string,{source:string,params:obj
|
|
|
929
929
|
export class ODEmbedManager<IdList extends ODEmbedManagerIdConstraint = ODEmbedManagerIdConstraint> extends ODManagerWithSafety<ODEmbed<string,{},string>> {
|
|
930
930
|
constructor(debug:ODDebugger){
|
|
931
931
|
super(() => {
|
|
932
|
-
return new ODEmbed("opendiscord:unknown-embed",(instance,params,
|
|
932
|
+
return new ODEmbed("opendiscord:unknown-embed",(instance,params,origin,cancel) => {
|
|
933
933
|
instance.setFooter("opendiscord:unknown-embed")
|
|
934
934
|
instance.setColor("#ff0000")
|
|
935
935
|
instance.setTitle("❌ <ODError:Unknown Embed>")
|
|
@@ -939,14 +939,14 @@ export class ODEmbedManager<IdList extends ODEmbedManagerIdConstraint = ODEmbedM
|
|
|
939
939
|
},debug,"embed")
|
|
940
940
|
}
|
|
941
941
|
|
|
942
|
-
get<EmbedId extends keyof ODNoGeneric<IdList>>(id:EmbedId): ODEmbed<IdList[EmbedId]["
|
|
942
|
+
get<EmbedId extends keyof ODNoGeneric<IdList>>(id:EmbedId): ODEmbed<IdList[EmbedId]["origin"],IdList[EmbedId]["params"],IdList[EmbedId]["workers"]>
|
|
943
943
|
get(id:ODValidId): ODEmbed<string,{},string>|null
|
|
944
944
|
|
|
945
945
|
get(id:ODValidId): ODEmbed<string,{},string>|null {
|
|
946
946
|
return super.get(id)
|
|
947
947
|
}
|
|
948
948
|
|
|
949
|
-
remove<EmbedId extends keyof ODNoGeneric<IdList>>(id:EmbedId): ODEmbed<IdList[EmbedId]["
|
|
949
|
+
remove<EmbedId extends keyof ODNoGeneric<IdList>>(id:EmbedId): ODEmbed<IdList[EmbedId]["origin"],IdList[EmbedId]["params"],IdList[EmbedId]["workers"]>
|
|
950
950
|
remove(id:ODValidId): ODEmbed<string,{},string>|null
|
|
951
951
|
|
|
952
952
|
remove(id:ODValidId): ODEmbed<string,{},string>|null {
|
|
@@ -960,7 +960,7 @@ export class ODEmbedManager<IdList extends ODEmbedManagerIdConstraint = ODEmbedM
|
|
|
960
960
|
return super.exists(id)
|
|
961
961
|
}
|
|
962
962
|
|
|
963
|
-
getSafe<EmbedId extends keyof ODNoGeneric<IdList>>(id:EmbedId): ODEmbed<IdList[EmbedId]["
|
|
963
|
+
getSafe<EmbedId extends keyof ODNoGeneric<IdList>>(id:EmbedId): ODEmbed<IdList[EmbedId]["origin"],IdList[EmbedId]["params"],IdList[EmbedId]["workers"]>
|
|
964
964
|
getSafe(id:ODValidId): ODEmbed<string,{},string>
|
|
965
965
|
|
|
966
966
|
getSafe(id:ODValidId): ODEmbed<string,{},string> {
|
|
@@ -1118,9 +1118,9 @@ export class ODEmbedInstance {
|
|
|
1118
1118
|
*
|
|
1119
1119
|
* This is possible by using "workers" or multiple functions that will be executed in priority order!
|
|
1120
1120
|
*/
|
|
1121
|
-
export class ODEmbed<
|
|
1121
|
+
export class ODEmbed<Origin extends string,Params,WorkerIds extends string = string> extends ODBuilderImplementation<ODEmbedInstance,Origin,Params,ODEmbedBuildResult,WorkerIds> {
|
|
1122
1122
|
/**Build this embed & compile it for discord.js */
|
|
1123
|
-
async build(
|
|
1123
|
+
async build(origin:Origin, params:Params): Promise<ODEmbedBuildResult> {
|
|
1124
1124
|
if (this.didCache && this.cache && this.allowCache) return this.cache
|
|
1125
1125
|
|
|
1126
1126
|
try{
|
|
@@ -1128,7 +1128,7 @@ export class ODEmbed<Source extends string,Params,WorkerIds extends string = str
|
|
|
1128
1128
|
const instance = new ODEmbedInstance()
|
|
1129
1129
|
|
|
1130
1130
|
//wait for workers to finish
|
|
1131
|
-
await this.workers.executeWorkers(instance,
|
|
1131
|
+
await this.workers.executeWorkers(instance,origin,params)
|
|
1132
1132
|
|
|
1133
1133
|
//create the discord.js embed
|
|
1134
1134
|
const embed = new discord.EmbedBuilder()
|
|
@@ -1215,7 +1215,7 @@ export class ODQuickEmbed {
|
|
|
1215
1215
|
/**## ODMessageManagerIdConstraint `type`
|
|
1216
1216
|
* The constraint/layout for id mappings/interfaces of the `ODMessageManager` class.
|
|
1217
1217
|
*/
|
|
1218
|
-
export type ODMessageManagerIdConstraint = Record<string,{
|
|
1218
|
+
export type ODMessageManagerIdConstraint = Record<string,{origin:string,params:object,workers:string}>
|
|
1219
1219
|
|
|
1220
1220
|
/**## ODMessageManager `class`
|
|
1221
1221
|
* This is an Open Discord message manager.
|
|
@@ -1227,21 +1227,21 @@ export type ODMessageManagerIdConstraint = Record<string,{source:string,params:o
|
|
|
1227
1227
|
export class ODMessageManager<IdList extends ODMessageManagerIdConstraint = ODMessageManagerIdConstraint> extends ODManagerWithSafety<ODMessage<string,{},string>> {
|
|
1228
1228
|
constructor(debug:ODDebugger){
|
|
1229
1229
|
super(() => {
|
|
1230
|
-
return new ODMessage("opendiscord:unknown-message",(instance,params,
|
|
1230
|
+
return new ODMessage("opendiscord:unknown-message",(instance,params,origin,cancel) => {
|
|
1231
1231
|
instance.setContent("**❌ <ODError:Unknown Message>**\nCouldn't find message in registery `opendiscord.builders.messages`")
|
|
1232
1232
|
cancel()
|
|
1233
1233
|
})
|
|
1234
1234
|
},debug,"message")
|
|
1235
1235
|
}
|
|
1236
1236
|
|
|
1237
|
-
get<MessageId extends keyof ODNoGeneric<IdList>>(id:MessageId): ODMessage<IdList[MessageId]["
|
|
1237
|
+
get<MessageId extends keyof ODNoGeneric<IdList>>(id:MessageId): ODMessage<IdList[MessageId]["origin"],IdList[MessageId]["params"],IdList[MessageId]["workers"]>
|
|
1238
1238
|
get(id:ODValidId): ODMessage<string,{},string>|null
|
|
1239
1239
|
|
|
1240
1240
|
get(id:ODValidId): ODMessage<string,{},string>|null {
|
|
1241
1241
|
return super.get(id)
|
|
1242
1242
|
}
|
|
1243
1243
|
|
|
1244
|
-
remove<MessageId extends keyof ODNoGeneric<IdList>>(id:MessageId): ODMessage<IdList[MessageId]["
|
|
1244
|
+
remove<MessageId extends keyof ODNoGeneric<IdList>>(id:MessageId): ODMessage<IdList[MessageId]["origin"],IdList[MessageId]["params"],IdList[MessageId]["workers"]>
|
|
1245
1245
|
remove(id:ODValidId): ODMessage<string,{},string>|null
|
|
1246
1246
|
|
|
1247
1247
|
remove(id:ODValidId): ODMessage<string,{},string>|null {
|
|
@@ -1255,7 +1255,7 @@ export class ODMessageManager<IdList extends ODMessageManagerIdConstraint = ODMe
|
|
|
1255
1255
|
return super.exists(id)
|
|
1256
1256
|
}
|
|
1257
1257
|
|
|
1258
|
-
getSafe<MessageId extends keyof ODNoGeneric<IdList>>(id:MessageId): ODMessage<IdList[MessageId]["
|
|
1258
|
+
getSafe<MessageId extends keyof ODNoGeneric<IdList>>(id:MessageId): ODMessage<IdList[MessageId]["origin"],IdList[MessageId]["params"],IdList[MessageId]["workers"]>
|
|
1259
1259
|
getSafe(id:ODValidId): ODMessage<string,{},string>
|
|
1260
1260
|
|
|
1261
1261
|
getSafe(id:ODValidId): ODMessage<string,{},string> {
|
|
@@ -1415,16 +1415,16 @@ export class ODMessageInstance {
|
|
|
1415
1415
|
*
|
|
1416
1416
|
* This is possible by using "workers" or multiple functions that will be executed in priority order!
|
|
1417
1417
|
*/
|
|
1418
|
-
export class ODMessage<
|
|
1418
|
+
export class ODMessage<Origin extends string,Params,WorkerIds extends string = string> extends ODBuilderImplementation<ODMessageInstance,Origin,Params,ODMessageBuildResult,WorkerIds> {
|
|
1419
1419
|
/**Build this message & compile it for discord.js */
|
|
1420
|
-
async build(
|
|
1420
|
+
async build(origin:Origin, params:Params){
|
|
1421
1421
|
if (this.didCache && this.cache && this.allowCache) return this.cache
|
|
1422
1422
|
|
|
1423
1423
|
//create instance
|
|
1424
1424
|
const instance = new ODMessageInstance()
|
|
1425
1425
|
|
|
1426
1426
|
//wait for workers to finish
|
|
1427
|
-
await this.workers.executeWorkers(instance,
|
|
1427
|
+
await this.workers.executeWorkers(instance,origin,params)
|
|
1428
1428
|
|
|
1429
1429
|
//create the discord.js message
|
|
1430
1430
|
const componentArray: discord.ActionRowBuilder<discord.MessageActionRowComponentBuilder>[] = []
|
|
@@ -1561,7 +1561,7 @@ export class ODQuickMessage {
|
|
|
1561
1561
|
/**## ODModalManagerIdConstraint `type`
|
|
1562
1562
|
* The constraint/layout for id mappings/interfaces of the `ODModalManager` class.
|
|
1563
1563
|
*/
|
|
1564
|
-
export type ODModalManagerIdConstraint = Record<string,{
|
|
1564
|
+
export type ODModalManagerIdConstraint = Record<string,{origin:string,params:object,workers:string}>
|
|
1565
1565
|
|
|
1566
1566
|
/**## ODModalManager `class`
|
|
1567
1567
|
* This is an Open Discord modal manager.
|
|
@@ -1573,7 +1573,7 @@ export type ODModalManagerIdConstraint = Record<string,{source:string,params:obj
|
|
|
1573
1573
|
export class ODModalManager<IdList extends ODModalManagerIdConstraint = ODModalManagerIdConstraint> extends ODManagerWithSafety<ODModal<string,{},string>> {
|
|
1574
1574
|
constructor(debug:ODDebugger){
|
|
1575
1575
|
super(() => {
|
|
1576
|
-
return new ODModal("opendiscord:unknown-modal",(instance,params,
|
|
1576
|
+
return new ODModal("opendiscord:unknown-modal",(instance,params,origin,cancel) => {
|
|
1577
1577
|
instance.setCustomId("od:unknown-modal")
|
|
1578
1578
|
instance.setTitle("❌ <ODError:Unknown Modal>")
|
|
1579
1579
|
instance.setQuestions(
|
|
@@ -1589,14 +1589,14 @@ export class ODModalManager<IdList extends ODModalManagerIdConstraint = ODModalM
|
|
|
1589
1589
|
},debug,"modal")
|
|
1590
1590
|
}
|
|
1591
1591
|
|
|
1592
|
-
get<ModalId extends keyof ODNoGeneric<IdList>>(id:ModalId): ODModal<IdList[ModalId]["
|
|
1592
|
+
get<ModalId extends keyof ODNoGeneric<IdList>>(id:ModalId): ODModal<IdList[ModalId]["origin"],IdList[ModalId]["params"],IdList[ModalId]["workers"]>
|
|
1593
1593
|
get(id:ODValidId): ODModal<string,{},string>|null
|
|
1594
1594
|
|
|
1595
1595
|
get(id:ODValidId): ODModal<string,{},string>|null {
|
|
1596
1596
|
return super.get(id)
|
|
1597
1597
|
}
|
|
1598
1598
|
|
|
1599
|
-
remove<ModalId extends keyof ODNoGeneric<IdList>>(id:ModalId): ODModal<IdList[ModalId]["
|
|
1599
|
+
remove<ModalId extends keyof ODNoGeneric<IdList>>(id:ModalId): ODModal<IdList[ModalId]["origin"],IdList[ModalId]["params"],IdList[ModalId]["workers"]>
|
|
1600
1600
|
remove(id:ODValidId): ODModal<string,{},string>|null
|
|
1601
1601
|
|
|
1602
1602
|
remove(id:ODValidId): ODModal<string,{},string>|null {
|
|
@@ -1610,7 +1610,7 @@ export class ODModalManager<IdList extends ODModalManagerIdConstraint = ODModalM
|
|
|
1610
1610
|
return super.exists(id)
|
|
1611
1611
|
}
|
|
1612
1612
|
|
|
1613
|
-
getSafe<ModalId extends keyof ODNoGeneric<IdList>>(id:ModalId): ODModal<IdList[ModalId]["
|
|
1613
|
+
getSafe<ModalId extends keyof ODNoGeneric<IdList>>(id:ModalId): ODModal<IdList[ModalId]["origin"],IdList[ModalId]["params"],IdList[ModalId]["workers"]>
|
|
1614
1614
|
getSafe(id:ODValidId): ODModal<string,{},string>
|
|
1615
1615
|
|
|
1616
1616
|
getSafe(id:ODValidId): ODModal<string,{},string> {
|
|
@@ -1717,16 +1717,16 @@ export class ODModalInstance {
|
|
|
1717
1717
|
*
|
|
1718
1718
|
* This is possible by using "workers" or multiple functions that will be executed in priority order!
|
|
1719
1719
|
*/
|
|
1720
|
-
export class ODModal<
|
|
1720
|
+
export class ODModal<Origin extends string,Params,WorkerIds extends string = string> extends ODBuilderImplementation<ODModalInstance,Origin,Params,ODModalBuildResult,WorkerIds> {
|
|
1721
1721
|
/**Build this modal & compile it for discord.js */
|
|
1722
|
-
async build(
|
|
1722
|
+
async build(origin:Origin, params:Params){
|
|
1723
1723
|
if (this.didCache && this.cache && this.allowCache) return this.cache
|
|
1724
1724
|
|
|
1725
1725
|
//create instance
|
|
1726
1726
|
const instance = new ODModalInstance()
|
|
1727
1727
|
|
|
1728
1728
|
//wait for workers to finish
|
|
1729
|
-
await this.workers.executeWorkers(instance,
|
|
1729
|
+
await this.workers.executeWorkers(instance,origin,params)
|
|
1730
1730
|
|
|
1731
1731
|
//create the discord.js modal
|
|
1732
1732
|
const modal = new discord.ModalBuilder()
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
///////////////////////////////////////
|
|
2
2
|
//CONFIG CHECKER MODULE
|
|
3
3
|
///////////////////////////////////////
|
|
4
|
-
import { ODDiscordIdType, ODId, ODManager, ODManagerData, ODNoGeneric, ODValidId, ODValidJsonType } from "./base"
|
|
5
|
-
import { ODConfig } from "./config"
|
|
6
|
-
import { ODLanguageManager } from "./language"
|
|
7
|
-
import { ODDebugger } from "./console"
|
|
4
|
+
import { ODDiscordIdType, ODId, ODManager, ODManagerData, ODNoGeneric, ODValidId, ODValidJsonType } from "./base.js"
|
|
5
|
+
import { ODConfig } from "./config.js"
|
|
6
|
+
import { ODLanguageManager } from "./language.js"
|
|
7
|
+
import { ODDebugger } from "./console.js"
|
|
8
8
|
import ansis from "ansis"
|
|
9
9
|
|
|
10
10
|
/**## ODCheckerResult `interface`
|
|
@@ -759,7 +759,7 @@ export class ODCheckerObjectStructure extends ODCheckerStructure {
|
|
|
759
759
|
super(id,options)
|
|
760
760
|
}
|
|
761
761
|
|
|
762
|
-
check(checker:ODChecker, value:
|
|
762
|
+
check(checker:ODChecker, value:Record<string,any>, locationTrace:ODCheckerLocationTrace): boolean {
|
|
763
763
|
const lt = checker.locationTraceDeref(locationTrace)
|
|
764
764
|
|
|
765
765
|
//check type & options
|
|
@@ -1318,7 +1318,7 @@ export class ODCheckerObjectSwitchStructure extends ODCheckerStructure {
|
|
|
1318
1318
|
super(id,options)
|
|
1319
1319
|
}
|
|
1320
1320
|
|
|
1321
|
-
check(checker:ODChecker, value:
|
|
1321
|
+
check(checker:ODChecker, value:Record<string,any>, locationTrace:ODCheckerLocationTrace): boolean {
|
|
1322
1322
|
const lt = checker.locationTraceDeref(locationTrace)
|
|
1323
1323
|
|
|
1324
1324
|
if (this.options.objects){
|
|
@@ -1381,7 +1381,7 @@ export class ODCheckerEnabledObjectStructure extends ODCheckerStructure {
|
|
|
1381
1381
|
super(id,options)
|
|
1382
1382
|
}
|
|
1383
1383
|
|
|
1384
|
-
check(checker:ODChecker, value:
|
|
1384
|
+
check(checker:ODChecker, value:Record<string,any>, locationTrace:ODCheckerLocationTrace): boolean {
|
|
1385
1385
|
const lt = checker.locationTraceDeref(locationTrace)
|
|
1386
1386
|
|
|
1387
1387
|
if (typeof value != "object"){
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
///////////////////////////////////////
|
|
2
2
|
//DISCORD CLIENT MODULE
|
|
3
3
|
///////////////////////////////////////
|
|
4
|
-
import { ODId, ODManager, ODManagerData, ODNoGeneric, ODSystemError, ODValidId } from "./base"
|
|
4
|
+
import { ODId, ODManager, ODManagerData, ODNoGeneric, ODSystemError, ODValidId } from "./base.js"
|
|
5
5
|
import * as discord from "discord.js"
|
|
6
6
|
import {REST} from "@discordjs/rest"
|
|
7
|
-
import {
|
|
8
|
-
import { ODMessageBuildResult, ODMessageBuildSentResult } from "./builder"
|
|
9
|
-
import { ODManualProgressBar } from "./progressbar"
|
|
7
|
+
import { ODWarningConsoleMessage, ODDebugger } from "./console.js"
|
|
8
|
+
import { ODMessageBuildResult, ODMessageBuildSentResult } from "./builder.js"
|
|
9
|
+
import { ODManualProgressBar } from "./progressbar.js"
|
|
10
10
|
|
|
11
11
|
/**## ODClientIntents `type`
|
|
12
12
|
* A list of intents required when inviting the bot.
|
|
@@ -165,7 +165,7 @@ export class ODClientManager<SlashIdList extends ODSlashCommandManagerIdConstrai
|
|
|
165
165
|
await this.client.login(this.token)
|
|
166
166
|
this.#debug.debug("Finished discord.js client.login()")
|
|
167
167
|
this.loggedIn = true
|
|
168
|
-
}catch(err){
|
|
168
|
+
}catch(err:any){
|
|
169
169
|
if (softErrors) return resolve(false)
|
|
170
170
|
else if (err.message.toLowerCase().includes("used disallowed intents")){
|
|
171
171
|
process.emit("uncaughtException",new ODSystemError("Used disallowed intents"))
|
|
@@ -542,7 +542,7 @@ export class ODSlashCommandComparator {
|
|
|
542
542
|
const nameLoc = choice.nameLocalizations ?? {}
|
|
543
543
|
return {
|
|
544
544
|
name:choice.name,
|
|
545
|
-
nameLocalizations:Object.keys(nameLoc).map((key) => {return {language:key as `${discord.Locale}`,value:nameLoc[key]}}),
|
|
545
|
+
nameLocalizations:(Object.keys(nameLoc) as discord.Locale[]).map((key) => {return {language:key as `${discord.Locale}`,value:nameLoc[key] as string}}),
|
|
546
546
|
value:choice.value
|
|
547
547
|
}
|
|
548
548
|
}
|
|
@@ -553,9 +553,9 @@ export class ODSlashCommandComparator {
|
|
|
553
553
|
return {
|
|
554
554
|
type:option.type,
|
|
555
555
|
name:option.name,
|
|
556
|
-
nameLocalizations:Object.keys(nameLoc).map((key) => {return {language:key as `${discord.Locale}`,value:nameLoc[key]}}),
|
|
556
|
+
nameLocalizations:(Object.keys(nameLoc) as discord.Locale[]).map((key) => {return {language:key as `${discord.Locale}`,value:nameLoc[key] as string}}),
|
|
557
557
|
description:option.description,
|
|
558
|
-
descriptionLocalizations:Object.keys(descLoc).map((key) => {return {language:key as `${discord.Locale}`,value:descLoc[key]}}),
|
|
558
|
+
descriptionLocalizations:(Object.keys(descLoc) as discord.Locale[]).map((key) => {return {language:key as `${discord.Locale}`,value:descLoc[key] as string}}),
|
|
559
559
|
required:(option.type != discord.ApplicationCommandOptionType.SubcommandGroup && option.type != discord.ApplicationCommandOptionType.Subcommand && option.required) ? true : false,
|
|
560
560
|
|
|
561
561
|
autocomplete:option.autocomplete ?? false,
|
|
@@ -576,9 +576,9 @@ export class ODSlashCommandComparator {
|
|
|
576
576
|
return {
|
|
577
577
|
type:option.type,
|
|
578
578
|
name:option.name,
|
|
579
|
-
nameLocalizations:Object.keys(nameLoc).map((key) => {return {language:key as `${discord.Locale}`,value:nameLoc[key]}}),
|
|
579
|
+
nameLocalizations:(Object.keys(nameLoc) as discord.Locale[]).map((key) => {return {language:key as `${discord.Locale}`,value:nameLoc[key] as string}}),
|
|
580
580
|
description:option.description,
|
|
581
|
-
descriptionLocalizations:Object.keys(descLoc).map((key) => {return {language:key as `${discord.Locale}`,value:descLoc[key]}}),
|
|
581
|
+
descriptionLocalizations:(Object.keys(descLoc) as discord.Locale[]).map((key) => {return {language:key as `${discord.Locale}`,value:descLoc[key] as string}}),
|
|
582
582
|
required:(option.type != discord.ApplicationCommandOptionType.SubcommandGroup && option.type != discord.ApplicationCommandOptionType.Subcommand && option.required) ? true : false,
|
|
583
583
|
|
|
584
584
|
autocomplete:option.autocomplete ?? false,
|
|
@@ -599,9 +599,9 @@ export class ODSlashCommandComparator {
|
|
|
599
599
|
return {
|
|
600
600
|
type:1,
|
|
601
601
|
name:builder.name,
|
|
602
|
-
nameLocalizations:Object.keys(nameLoc).map((key) => {return {language:key as `${discord.Locale}`,value:nameLoc[key]}}),
|
|
602
|
+
nameLocalizations:(Object.keys(nameLoc) as discord.Locale[]).map((key) => {return {language:key as `${discord.Locale}`,value:nameLoc[key] as string}}),
|
|
603
603
|
description:builder.description,
|
|
604
|
-
descriptionLocalizations:Object.keys(descLoc).map((key) => {return {language:key as `${discord.Locale}`,value:descLoc[key]}}),
|
|
604
|
+
descriptionLocalizations:(Object.keys(descLoc) as discord.Locale[]).map((key) => {return {language:key as `${discord.Locale}`,value:descLoc[key] as string}}),
|
|
605
605
|
guildId:guildId,
|
|
606
606
|
nsfw:builder.nsfw ?? false,
|
|
607
607
|
options:builder.options ? builder.options.map((opt) => this.#convertBuilderOption(opt)) : [],
|
|
@@ -619,9 +619,9 @@ export class ODSlashCommandComparator {
|
|
|
619
619
|
return {
|
|
620
620
|
type:1,
|
|
621
621
|
name:cmd.name,
|
|
622
|
-
nameLocalizations:Object.keys(nameLoc).map((key) => {return {language:key as `${discord.Locale}`,value:nameLoc[key]}}),
|
|
622
|
+
nameLocalizations:(Object.keys(nameLoc) as discord.Locale[]).map((key) => {return {language:key as `${discord.Locale}`,value:nameLoc[key] as string}}),
|
|
623
623
|
description:cmd.description,
|
|
624
|
-
descriptionLocalizations:Object.keys(descLoc).map((key) => {return {language:key as `${discord.Locale}`,value:descLoc[key]}}),
|
|
624
|
+
descriptionLocalizations:(Object.keys(descLoc) as discord.Locale[]).map((key) => {return {language:key as `${discord.Locale}`,value:descLoc[key] as string}}),
|
|
625
625
|
guildId:cmd.guildId,
|
|
626
626
|
nsfw:cmd.nsfw,
|
|
627
627
|
options:cmd.options ? cmd.options.map((opt) => this.#convertCommandOption(opt)) : [],
|
|
@@ -946,7 +946,7 @@ export class ODSlashCommandManager<IdList extends ODSlashCommandManagerIdConstra
|
|
|
946
946
|
})
|
|
947
947
|
|
|
948
948
|
if (this.#interactionListeners.length > this.listenerLimit){
|
|
949
|
-
this.#debug.console.log(new
|
|
949
|
+
this.#debug.console.log(new ODWarningConsoleMessage("Possible slash command interaction memory leak detected!",[
|
|
950
950
|
{key:"listeners",value:this.#interactionListeners.length.toString()}
|
|
951
951
|
]))
|
|
952
952
|
}
|
|
@@ -1821,7 +1821,7 @@ export class ODTextCommandManager<IdList extends ODTextCommandManagerIdConstrain
|
|
|
1821
1821
|
})
|
|
1822
1822
|
|
|
1823
1823
|
if (this.#interactionListeners.length > this.listenerLimit){
|
|
1824
|
-
this.#debug.console.log(new
|
|
1824
|
+
this.#debug.console.log(new ODWarningConsoleMessage("Possible text command interaction memory leak detected!",[
|
|
1825
1825
|
{key:"listeners",value:this.#interactionListeners.length.toString()}
|
|
1826
1826
|
]))
|
|
1827
1827
|
}
|
|
@@ -1923,7 +1923,7 @@ export class ODContextMenuComparator {
|
|
|
1923
1923
|
return {
|
|
1924
1924
|
type:builder.type,
|
|
1925
1925
|
name:builder.name,
|
|
1926
|
-
nameLocalizations:Object.keys(nameLoc).map((key) => {return {language:key as `${discord.Locale}`,value:nameLoc[key]}}),
|
|
1926
|
+
nameLocalizations:(Object.keys(nameLoc) as discord.Locale[]).map((key) => {return {language:key as `${discord.Locale}`,value:nameLoc[key] as string}}),
|
|
1927
1927
|
guildId:guildId,
|
|
1928
1928
|
nsfw:builder.nsfw ?? false,
|
|
1929
1929
|
defaultMemberPermissions:discord.PermissionsBitField.resolve(builder.defaultMemberPermissions ?? ["ViewChannel"]),
|
|
@@ -1940,7 +1940,7 @@ export class ODContextMenuComparator {
|
|
|
1940
1940
|
return {
|
|
1941
1941
|
type:cmd.type,
|
|
1942
1942
|
name:cmd.name,
|
|
1943
|
-
nameLocalizations:Object.keys(nameLoc).map((key) => {return {language:key as `${discord.Locale}`,value:nameLoc[key]}}),
|
|
1943
|
+
nameLocalizations:(Object.keys(nameLoc) as discord.Locale[]).map((key) => {return {language:key as `${discord.Locale}`,value:nameLoc[key] as string}}),
|
|
1944
1944
|
guildId:cmd.guildId,
|
|
1945
1945
|
nsfw:cmd.nsfw,
|
|
1946
1946
|
defaultMemberPermissions:discord.PermissionsBitField.resolve(cmd.defaultMemberPermissions ?? ["ViewChannel"]),
|
package/src/api/modules/code.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
///////////////////////////////////////
|
|
2
2
|
//CODE MODULE
|
|
3
3
|
///////////////////////////////////////
|
|
4
|
-
import { ODId, ODManager, ODManagerData, ODNoGeneric, ODValidId } from "./base"
|
|
5
|
-
import { ODDebugger } from "./console"
|
|
4
|
+
import { ODId, ODManager, ODManagerData, ODNoGeneric, ODValidId } from "./base.js"
|
|
5
|
+
import { ODDebugger } from "./console.js"
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
/**## ODCode `class`
|