@open-discord-bots/framework 0.1.1 → 0.2.0
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/modules/action.d.ts +26 -4
- package/dist/api/modules/action.js +16 -0
- package/dist/api/modules/base.d.ts +12 -2
- package/dist/api/modules/base.js +11 -1
- package/dist/api/modules/builder.d.ts +117 -21
- package/dist/api/modules/builder.js +72 -0
- package/dist/api/modules/checker.d.ts +111 -15
- package/dist/api/modules/checker.js +201 -9
- package/dist/api/modules/client.d.ts +45 -22
- package/dist/api/modules/client.js +58 -34
- package/dist/api/modules/code.d.ts +11 -1
- package/dist/api/modules/code.js +9 -0
- package/dist/api/modules/config.d.ts +15 -5
- package/dist/api/modules/config.js +9 -0
- package/dist/api/modules/console.d.ts +11 -1
- package/dist/api/modules/console.js +9 -0
- package/dist/api/modules/cooldown.d.ts +11 -1
- package/dist/api/modules/cooldown.js +9 -0
- package/dist/api/modules/database.d.ts +36 -4
- package/dist/api/modules/database.js +9 -17
- package/dist/api/modules/event.d.ts +10 -1
- package/dist/api/modules/event.js +6 -0
- package/dist/api/modules/flag.d.ts +11 -1
- package/dist/api/modules/flag.js +9 -0
- package/dist/api/modules/helpmenu.d.ts +22 -2
- package/dist/api/modules/helpmenu.js +18 -0
- package/dist/api/modules/language.d.ts +15 -1
- package/dist/api/modules/language.js +9 -4
- package/dist/api/modules/permission.d.ts +11 -1
- package/dist/api/modules/permission.js +9 -0
- package/dist/api/modules/plugin.d.ts +23 -3
- package/dist/api/modules/plugin.js +18 -0
- package/dist/api/modules/post.d.ts +11 -1
- package/dist/api/modules/post.js +9 -0
- package/dist/api/modules/progressbar.d.ts +24 -3
- package/dist/api/modules/progressbar.js +19 -0
- package/dist/api/modules/responder.d.ts +105 -21
- package/dist/api/modules/responder.js +54 -0
- package/dist/api/modules/session.d.ts +11 -1
- package/dist/api/modules/session.js +9 -0
- package/dist/api/modules/startscreen.d.ts +17 -7
- package/dist/api/modules/startscreen.js +9 -0
- package/dist/api/modules/stat.d.ts +42 -8
- package/dist/api/modules/stat.js +18 -4
- package/dist/api/modules/verifybar.d.ts +18 -4
- package/dist/api/modules/verifybar.js +9 -0
- package/dist/api/modules/worker.d.ts +7 -1
- package/dist/api/modules/worker.js +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/utilities/index.js +1 -0
- package/package.json +1 -1
- package/src/api/main.ts +10 -10
- package/src/api/modules/action.ts +37 -4
- package/src/api/modules/base.ts +30 -3
- package/src/api/modules/builder.ts +226 -21
- package/src/api/modules/checker.ts +292 -17
- package/src/api/modules/client.ts +129 -43
- package/src/api/modules/code.ts +27 -1
- package/src/api/modules/config.ts +33 -7
- package/src/api/modules/console.ts +27 -1
- package/src/api/modules/cooldown.ts +27 -1
- package/src/api/modules/database.ts +55 -4
- package/src/api/modules/event.ts +24 -1
- package/src/api/modules/flag.ts +27 -1
- package/src/api/modules/helpmenu.ts +55 -2
- package/src/api/modules/language.ts +35 -1
- package/src/api/modules/permission.ts +27 -1
- package/src/api/modules/plugin.ts +55 -3
- package/src/api/modules/post.ts +27 -1
- package/src/api/modules/progressbar.ts +56 -3
- package/src/api/modules/responder.ts +184 -21
- package/src/api/modules/session.ts +27 -1
- package/src/api/modules/startscreen.ts +33 -7
- package/src/api/modules/stat.ts +79 -8
- package/src/api/modules/verifybar.ts +31 -5
- package/src/api/modules/worker.ts +22 -1
- package/src/utilities/index.ts +1 -0
|
@@ -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,Source extends string,Params,BuildType extends {id:ODId}> extends ODManagerData {
|
|
16
|
+
export class ODBuilderImplementation<Instance,Source 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,Source,Params>
|
|
18
|
+
workers: ODWorkerManager<Instance,Source,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? */
|
|
@@ -61,19 +61,26 @@ export class ODBuilderImplementation<Instance,Source extends string,Params,Build
|
|
|
61
61
|
* - get to know the source of the build request for a specific message, button, etc
|
|
62
62
|
* - And so much more!
|
|
63
63
|
*/
|
|
64
|
-
export class ODBuilderManager
|
|
64
|
+
export class ODBuilderManager<
|
|
65
|
+
ButtonIdList extends ODButtonManagerIdConstraint = ODButtonManagerIdConstraint,
|
|
66
|
+
DropdownIdList extends ODDropdownManagerIdConstraint = ODDropdownManagerIdConstraint,
|
|
67
|
+
FileIdList extends ODFileManagerIdConstraint = ODFileManagerIdConstraint,
|
|
68
|
+
EmbedIdList extends ODEmbedManagerIdConstraint = ODEmbedManagerIdConstraint,
|
|
69
|
+
MessageIdList extends ODMessageManagerIdConstraint = ODMessageManagerIdConstraint,
|
|
70
|
+
ModalIdList extends ODModalManagerIdConstraint = ODModalManagerIdConstraint
|
|
71
|
+
> {
|
|
65
72
|
/**The manager for all button builders */
|
|
66
|
-
buttons: ODButtonManager
|
|
73
|
+
buttons: ODButtonManager<ButtonIdList>
|
|
67
74
|
/**The manager for all dropdown builders */
|
|
68
|
-
dropdowns: ODDropdownManager
|
|
75
|
+
dropdowns: ODDropdownManager<DropdownIdList>
|
|
69
76
|
/**The manager for all file/attachment builders */
|
|
70
|
-
files: ODFileManager
|
|
77
|
+
files: ODFileManager<FileIdList>
|
|
71
78
|
/**The manager for all embed builders */
|
|
72
|
-
embeds: ODEmbedManager
|
|
79
|
+
embeds: ODEmbedManager<EmbedIdList>
|
|
73
80
|
/**The manager for all message builders */
|
|
74
|
-
messages: ODMessageManager
|
|
81
|
+
messages: ODMessageManager<MessageIdList>
|
|
75
82
|
/**The manager for all modal builders */
|
|
76
|
-
modals: ODModalManager
|
|
83
|
+
modals: ODModalManager<ModalIdList>
|
|
77
84
|
|
|
78
85
|
constructor(debug:ODDebugger){
|
|
79
86
|
this.buttons = new ODButtonManager(debug)
|
|
@@ -95,6 +102,11 @@ export interface ODComponentBuildResult {
|
|
|
95
102
|
component:discord.MessageActionRowComponentBuilder|"\n"|null
|
|
96
103
|
}
|
|
97
104
|
|
|
105
|
+
/**## ODButtonManagerIdConstraint `type`
|
|
106
|
+
* The constraint/layout for id mappings/interfaces of the `ODButtonManager` class.
|
|
107
|
+
*/
|
|
108
|
+
export type ODButtonManagerIdConstraint = Record<string,{source:string,params:object,workers:string}>
|
|
109
|
+
|
|
98
110
|
/**## ODButtonManager `class`
|
|
99
111
|
* This is an Open Discord button manager.
|
|
100
112
|
*
|
|
@@ -102,7 +114,7 @@ export interface ODComponentBuildResult {
|
|
|
102
114
|
*
|
|
103
115
|
* It's recommended to use this system in combination with all the other Open Discord builders!
|
|
104
116
|
*/
|
|
105
|
-
export class ODButtonManager extends ODManagerWithSafety<ODButton<string,
|
|
117
|
+
export class ODButtonManager<IdList extends ODButtonManagerIdConstraint = ODButtonManagerIdConstraint> extends ODManagerWithSafety<ODButton<string,{},string>> {
|
|
106
118
|
constructor(debug:ODDebugger){
|
|
107
119
|
super(() => {
|
|
108
120
|
return new ODButton("opendiscord:unknown-button",(instance,params,source,cancel) => {
|
|
@@ -124,6 +136,34 @@ export class ODButtonManager extends ODManagerWithSafety<ODButton<string,any>> {
|
|
|
124
136
|
component:"\n"
|
|
125
137
|
}
|
|
126
138
|
}
|
|
139
|
+
|
|
140
|
+
get<ButtonId extends keyof IdList>(id:ButtonId): ODButton<IdList[ButtonId]["source"],IdList[ButtonId]["params"],IdList[ButtonId]["workers"]>
|
|
141
|
+
get(id:ODValidId): ODButton<string,{},string>|null
|
|
142
|
+
|
|
143
|
+
get(id:ODValidId): ODButton<string,{},string>|null {
|
|
144
|
+
return super.get(id)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
remove<ButtonId extends keyof IdList>(id:ButtonId): ODButton<IdList[ButtonId]["source"],IdList[ButtonId]["params"],IdList[ButtonId]["workers"]>
|
|
148
|
+
remove(id:ODValidId): ODButton<string,{},string>|null
|
|
149
|
+
|
|
150
|
+
remove(id:ODValidId): ODButton<string,{},string>|null {
|
|
151
|
+
return super.remove(id)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
exists(id:keyof IdList): boolean
|
|
155
|
+
exists(id:ODValidId): boolean
|
|
156
|
+
|
|
157
|
+
exists(id:ODValidId): boolean {
|
|
158
|
+
return super.exists(id)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
getSafe<ButtonId extends keyof IdList>(id:ButtonId): ODButton<IdList[ButtonId]["source"],IdList[ButtonId]["params"],IdList[ButtonId]["workers"]>
|
|
162
|
+
getSafe(id:ODValidId): ODButton<string,{},string>
|
|
163
|
+
|
|
164
|
+
getSafe(id:ODValidId): ODButton<string,{},string> {
|
|
165
|
+
return super.getSafe(id)
|
|
166
|
+
}
|
|
127
167
|
}
|
|
128
168
|
|
|
129
169
|
/**## ODButtonData `interface`
|
|
@@ -208,7 +248,7 @@ export class ODButtonInstance {
|
|
|
208
248
|
*
|
|
209
249
|
* This is possible by using "workers" or multiple functions that will be executed in priority order!
|
|
210
250
|
*/
|
|
211
|
-
export class ODButton<Source extends string,Params> extends ODBuilderImplementation<ODButtonInstance,Source,Params,ODComponentBuildResult> {
|
|
251
|
+
export class ODButton<Source extends string,Params,WorkerIds extends string = string> extends ODBuilderImplementation<ODButtonInstance,Source,Params,ODComponentBuildResult,WorkerIds> {
|
|
212
252
|
/**Build this button & compile it for discord.js */
|
|
213
253
|
async build(source:Source, params:Params): Promise<ODComponentBuildResult> {
|
|
214
254
|
if (this.didCache && this.cache && this.allowCache) return this.cache
|
|
@@ -291,6 +331,11 @@ export class ODQuickButton {
|
|
|
291
331
|
}
|
|
292
332
|
}
|
|
293
333
|
|
|
334
|
+
/**## ODDropdownManagerIdConstraint `type`
|
|
335
|
+
* The constraint/layout for id mappings/interfaces of the `ODDropdownManager` class.
|
|
336
|
+
*/
|
|
337
|
+
export type ODDropdownManagerIdConstraint = Record<string,{source:string,params:object,workers:string}>
|
|
338
|
+
|
|
294
339
|
/**## ODDropdownManager `class`
|
|
295
340
|
* This is an Open Discord dropdown manager.
|
|
296
341
|
*
|
|
@@ -298,7 +343,7 @@ export class ODQuickButton {
|
|
|
298
343
|
*
|
|
299
344
|
* It's recommended to use this system in combination with all the other Open Discord builders!
|
|
300
345
|
*/
|
|
301
|
-
export class ODDropdownManager extends ODManagerWithSafety<ODDropdown<string,
|
|
346
|
+
export class ODDropdownManager<IdList extends ODDropdownManagerIdConstraint = ODDropdownManagerIdConstraint> extends ODManagerWithSafety<ODDropdown<string,{},string>> {
|
|
302
347
|
constructor(debug:ODDebugger){
|
|
303
348
|
super(() => {
|
|
304
349
|
return new ODDropdown("opendiscord:unknown-dropdown",(instance,params,source,cancel) => {
|
|
@@ -321,6 +366,34 @@ export class ODDropdownManager extends ODManagerWithSafety<ODDropdown<string,any
|
|
|
321
366
|
component:"\n"
|
|
322
367
|
}
|
|
323
368
|
}
|
|
369
|
+
|
|
370
|
+
get<DropdownId extends keyof IdList>(id:DropdownId): ODDropdown<IdList[DropdownId]["source"],IdList[DropdownId]["params"],IdList[DropdownId]["workers"]>
|
|
371
|
+
get(id:ODValidId): ODDropdown<string,{},string>|null
|
|
372
|
+
|
|
373
|
+
get(id:ODValidId): ODDropdown<string,{},string>|null {
|
|
374
|
+
return super.get(id)
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
remove<DropdownId extends keyof IdList>(id:DropdownId): ODDropdown<IdList[DropdownId]["source"],IdList[DropdownId]["params"],IdList[DropdownId]["workers"]>
|
|
378
|
+
remove(id:ODValidId): ODDropdown<string,{},string>|null
|
|
379
|
+
|
|
380
|
+
remove(id:ODValidId): ODDropdown<string,{},string>|null {
|
|
381
|
+
return super.remove(id)
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
exists(id:keyof IdList): boolean
|
|
385
|
+
exists(id:ODValidId): boolean
|
|
386
|
+
|
|
387
|
+
exists(id:ODValidId): boolean {
|
|
388
|
+
return super.exists(id)
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
getSafe<DropdownId extends keyof IdList>(id:DropdownId): ODDropdown<IdList[DropdownId]["source"],IdList[DropdownId]["params"],IdList[DropdownId]["workers"]>
|
|
392
|
+
getSafe(id:ODValidId): ODDropdown<string,{},string>
|
|
393
|
+
|
|
394
|
+
getSafe(id:ODValidId): ODDropdown<string,{},string> {
|
|
395
|
+
return super.getSafe(id)
|
|
396
|
+
}
|
|
324
397
|
}
|
|
325
398
|
|
|
326
399
|
/**## ODDropdownData `interface`
|
|
@@ -447,7 +520,7 @@ export class ODDropdownInstance {
|
|
|
447
520
|
*
|
|
448
521
|
* This is possible by using "workers" or multiple functions that will be executed in priority order!
|
|
449
522
|
*/
|
|
450
|
-
export class ODDropdown<Source extends string,Params> extends ODBuilderImplementation<ODDropdownInstance,Source,Params,ODComponentBuildResult> {
|
|
523
|
+
export class ODDropdown<Source extends string,Params,WorkerIds extends string = string> extends ODBuilderImplementation<ODDropdownInstance,Source,Params,ODComponentBuildResult,WorkerIds> {
|
|
451
524
|
/**Build this dropdown & compile it for discord.js */
|
|
452
525
|
async build(source:Source, params:Params): Promise<ODComponentBuildResult> {
|
|
453
526
|
if (this.didCache && this.cache && this.allowCache) return this.cache
|
|
@@ -648,6 +721,11 @@ export class ODQuickDropdown {
|
|
|
648
721
|
}
|
|
649
722
|
}
|
|
650
723
|
|
|
724
|
+
/**## ODFileManagerIdConstraint `type`
|
|
725
|
+
* The constraint/layout for id mappings/interfaces of the `ODFileManager` class.
|
|
726
|
+
*/
|
|
727
|
+
export type ODFileManagerIdConstraint = Record<string,{source:string,params:object,workers:string}>
|
|
728
|
+
|
|
651
729
|
/**## ODFileManager `class`
|
|
652
730
|
* This is an Open Discord file manager.
|
|
653
731
|
*
|
|
@@ -655,7 +733,7 @@ export class ODQuickDropdown {
|
|
|
655
733
|
*
|
|
656
734
|
* It's recommended to use this system in combination with all the other Open Discord builders!
|
|
657
735
|
*/
|
|
658
|
-
export class ODFileManager extends ODManagerWithSafety<ODFile<string,
|
|
736
|
+
export class ODFileManager<IdList extends ODFileManagerIdConstraint = ODFileManagerIdConstraint> extends ODManagerWithSafety<ODFile<string,{},string>> {
|
|
659
737
|
constructor(debug:ODDebugger){
|
|
660
738
|
super(() => {
|
|
661
739
|
return new ODFile("opendiscord:unknown-file",(instance,params,source,cancel) => {
|
|
@@ -666,6 +744,34 @@ export class ODFileManager extends ODManagerWithSafety<ODFile<string,any>> {
|
|
|
666
744
|
})
|
|
667
745
|
},debug,"file")
|
|
668
746
|
}
|
|
747
|
+
|
|
748
|
+
get<FileId extends keyof IdList>(id:FileId): ODFile<IdList[FileId]["source"],IdList[FileId]["params"],IdList[FileId]["workers"]>
|
|
749
|
+
get(id:ODValidId): ODFile<string,{},string>|null
|
|
750
|
+
|
|
751
|
+
get(id:ODValidId): ODFile<string,{},string>|null {
|
|
752
|
+
return super.get(id)
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
remove<FileId extends keyof IdList>(id:FileId): ODFile<IdList[FileId]["source"],IdList[FileId]["params"],IdList[FileId]["workers"]>
|
|
756
|
+
remove(id:ODValidId): ODFile<string,{},string>|null
|
|
757
|
+
|
|
758
|
+
remove(id:ODValidId): ODFile<string,{},string>|null {
|
|
759
|
+
return super.remove(id)
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
exists(id:keyof IdList): boolean
|
|
763
|
+
exists(id:ODValidId): boolean
|
|
764
|
+
|
|
765
|
+
exists(id:ODValidId): boolean {
|
|
766
|
+
return super.exists(id)
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
getSafe<FileId extends keyof IdList>(id:FileId): ODFile<IdList[FileId]["source"],IdList[FileId]["params"],IdList[FileId]["workers"]>
|
|
770
|
+
getSafe(id:ODValidId): ODFile<string,{},string>
|
|
771
|
+
|
|
772
|
+
getSafe(id:ODValidId): ODFile<string,{},string> {
|
|
773
|
+
return super.getSafe(id)
|
|
774
|
+
}
|
|
669
775
|
}
|
|
670
776
|
|
|
671
777
|
/**## ODFileData `interface`
|
|
@@ -741,7 +847,7 @@ export class ODFileInstance {
|
|
|
741
847
|
*
|
|
742
848
|
* This is possible by using "workers" or multiple functions that will be executed in priority order!
|
|
743
849
|
*/
|
|
744
|
-
export class ODFile<Source extends string,Params> extends ODBuilderImplementation<ODFileInstance,Source,Params,ODFileBuildResult> {
|
|
850
|
+
export class ODFile<Source extends string,Params,WorkerIds extends string = string> extends ODBuilderImplementation<ODFileInstance,Source,Params,ODFileBuildResult,WorkerIds> {
|
|
745
851
|
/**Build this attachment & compile it for discord.js */
|
|
746
852
|
async build(source:Source, params:Params): Promise<ODFileBuildResult> {
|
|
747
853
|
if (this.didCache && this.cache && this.allowCache) return this.cache
|
|
@@ -808,6 +914,11 @@ export class ODQuickFile {
|
|
|
808
914
|
}
|
|
809
915
|
}
|
|
810
916
|
|
|
917
|
+
/**## ODEmbedManagerIdConstraint `type`
|
|
918
|
+
* The constraint/layout for id mappings/interfaces of the `ODEmbedManager` class.
|
|
919
|
+
*/
|
|
920
|
+
export type ODEmbedManagerIdConstraint = Record<string,{source:string,params:object,workers:string}>
|
|
921
|
+
|
|
811
922
|
/**## ODEmbedManager `class`
|
|
812
923
|
* This is an Open Discord embed manager.
|
|
813
924
|
*
|
|
@@ -815,7 +926,7 @@ export class ODQuickFile {
|
|
|
815
926
|
*
|
|
816
927
|
* It's recommended to use this system in combination with all the other Open Discord builders!
|
|
817
928
|
*/
|
|
818
|
-
export class ODEmbedManager extends ODManagerWithSafety<ODEmbed<string,
|
|
929
|
+
export class ODEmbedManager<IdList extends ODEmbedManagerIdConstraint = ODEmbedManagerIdConstraint> extends ODManagerWithSafety<ODEmbed<string,{},string>> {
|
|
819
930
|
constructor(debug:ODDebugger){
|
|
820
931
|
super(() => {
|
|
821
932
|
return new ODEmbed("opendiscord:unknown-embed",(instance,params,source,cancel) => {
|
|
@@ -827,6 +938,34 @@ export class ODEmbedManager extends ODManagerWithSafety<ODEmbed<string,any>> {
|
|
|
827
938
|
})
|
|
828
939
|
},debug,"embed")
|
|
829
940
|
}
|
|
941
|
+
|
|
942
|
+
get<EmbedId extends keyof IdList>(id:EmbedId): ODEmbed<IdList[EmbedId]["source"],IdList[EmbedId]["params"],IdList[EmbedId]["workers"]>
|
|
943
|
+
get(id:ODValidId): ODEmbed<string,{},string>|null
|
|
944
|
+
|
|
945
|
+
get(id:ODValidId): ODEmbed<string,{},string>|null {
|
|
946
|
+
return super.get(id)
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
remove<EmbedId extends keyof IdList>(id:EmbedId): ODEmbed<IdList[EmbedId]["source"],IdList[EmbedId]["params"],IdList[EmbedId]["workers"]>
|
|
950
|
+
remove(id:ODValidId): ODEmbed<string,{},string>|null
|
|
951
|
+
|
|
952
|
+
remove(id:ODValidId): ODEmbed<string,{},string>|null {
|
|
953
|
+
return super.remove(id)
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
exists(id:keyof IdList): boolean
|
|
957
|
+
exists(id:ODValidId): boolean
|
|
958
|
+
|
|
959
|
+
exists(id:ODValidId): boolean {
|
|
960
|
+
return super.exists(id)
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
getSafe<EmbedId extends keyof IdList>(id:EmbedId): ODEmbed<IdList[EmbedId]["source"],IdList[EmbedId]["params"],IdList[EmbedId]["workers"]>
|
|
964
|
+
getSafe(id:ODValidId): ODEmbed<string,{},string>
|
|
965
|
+
|
|
966
|
+
getSafe(id:ODValidId): ODEmbed<string,{},string> {
|
|
967
|
+
return super.getSafe(id)
|
|
968
|
+
}
|
|
830
969
|
}
|
|
831
970
|
|
|
832
971
|
/**## ODEmbedData `interface`
|
|
@@ -979,7 +1118,7 @@ export class ODEmbedInstance {
|
|
|
979
1118
|
*
|
|
980
1119
|
* This is possible by using "workers" or multiple functions that will be executed in priority order!
|
|
981
1120
|
*/
|
|
982
|
-
export class ODEmbed<Source extends string,Params> extends ODBuilderImplementation<ODEmbedInstance,Source,Params,ODEmbedBuildResult> {
|
|
1121
|
+
export class ODEmbed<Source extends string,Params,WorkerIds extends string = string> extends ODBuilderImplementation<ODEmbedInstance,Source,Params,ODEmbedBuildResult,WorkerIds> {
|
|
983
1122
|
/**Build this embed & compile it for discord.js */
|
|
984
1123
|
async build(source:Source, params:Params): Promise<ODEmbedBuildResult> {
|
|
985
1124
|
if (this.didCache && this.cache && this.allowCache) return this.cache
|
|
@@ -1073,6 +1212,11 @@ export class ODQuickEmbed {
|
|
|
1073
1212
|
}
|
|
1074
1213
|
}
|
|
1075
1214
|
|
|
1215
|
+
/**## ODMessageManagerIdConstraint `type`
|
|
1216
|
+
* The constraint/layout for id mappings/interfaces of the `ODMessageManager` class.
|
|
1217
|
+
*/
|
|
1218
|
+
export type ODMessageManagerIdConstraint = Record<string,{source:string,params:object,workers:string}>
|
|
1219
|
+
|
|
1076
1220
|
/**## ODMessageManager `class`
|
|
1077
1221
|
* This is an Open Discord message manager.
|
|
1078
1222
|
*
|
|
@@ -1080,7 +1224,7 @@ export class ODQuickEmbed {
|
|
|
1080
1224
|
*
|
|
1081
1225
|
* It's recommended to use this system in combination with all the other Open Discord builders!
|
|
1082
1226
|
*/
|
|
1083
|
-
export class ODMessageManager extends ODManagerWithSafety<ODMessage<string,
|
|
1227
|
+
export class ODMessageManager<IdList extends ODMessageManagerIdConstraint = ODMessageManagerIdConstraint> extends ODManagerWithSafety<ODMessage<string,{},string>> {
|
|
1084
1228
|
constructor(debug:ODDebugger){
|
|
1085
1229
|
super(() => {
|
|
1086
1230
|
return new ODMessage("opendiscord:unknown-message",(instance,params,source,cancel) => {
|
|
@@ -1089,6 +1233,34 @@ export class ODMessageManager extends ODManagerWithSafety<ODMessage<string,any>>
|
|
|
1089
1233
|
})
|
|
1090
1234
|
},debug,"message")
|
|
1091
1235
|
}
|
|
1236
|
+
|
|
1237
|
+
get<MessageId extends keyof IdList>(id:MessageId): ODMessage<IdList[MessageId]["source"],IdList[MessageId]["params"],IdList[MessageId]["workers"]>
|
|
1238
|
+
get(id:ODValidId): ODMessage<string,{},string>|null
|
|
1239
|
+
|
|
1240
|
+
get(id:ODValidId): ODMessage<string,{},string>|null {
|
|
1241
|
+
return super.get(id)
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
remove<MessageId extends keyof IdList>(id:MessageId): ODMessage<IdList[MessageId]["source"],IdList[MessageId]["params"],IdList[MessageId]["workers"]>
|
|
1245
|
+
remove(id:ODValidId): ODMessage<string,{},string>|null
|
|
1246
|
+
|
|
1247
|
+
remove(id:ODValidId): ODMessage<string,{},string>|null {
|
|
1248
|
+
return super.remove(id)
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
exists(id:keyof IdList): boolean
|
|
1252
|
+
exists(id:ODValidId): boolean
|
|
1253
|
+
|
|
1254
|
+
exists(id:ODValidId): boolean {
|
|
1255
|
+
return super.exists(id)
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
getSafe<MessageId extends keyof IdList>(id:MessageId): ODMessage<IdList[MessageId]["source"],IdList[MessageId]["params"],IdList[MessageId]["workers"]>
|
|
1259
|
+
getSafe(id:ODValidId): ODMessage<string,{},string>
|
|
1260
|
+
|
|
1261
|
+
getSafe(id:ODValidId): ODMessage<string,{},string> {
|
|
1262
|
+
return super.getSafe(id)
|
|
1263
|
+
}
|
|
1092
1264
|
}
|
|
1093
1265
|
|
|
1094
1266
|
/**## ODMessageData `interface`
|
|
@@ -1243,7 +1415,7 @@ export class ODMessageInstance {
|
|
|
1243
1415
|
*
|
|
1244
1416
|
* This is possible by using "workers" or multiple functions that will be executed in priority order!
|
|
1245
1417
|
*/
|
|
1246
|
-
export class ODMessage<Source extends string,Params> extends ODBuilderImplementation<ODMessageInstance,Source,Params,ODMessageBuildResult> {
|
|
1418
|
+
export class ODMessage<Source extends string,Params,WorkerIds extends string = string> extends ODBuilderImplementation<ODMessageInstance,Source,Params,ODMessageBuildResult,WorkerIds> {
|
|
1247
1419
|
/**Build this message & compile it for discord.js */
|
|
1248
1420
|
async build(source:Source, params:Params){
|
|
1249
1421
|
if (this.didCache && this.cache && this.allowCache) return this.cache
|
|
@@ -1386,6 +1558,11 @@ export class ODQuickMessage {
|
|
|
1386
1558
|
}
|
|
1387
1559
|
}
|
|
1388
1560
|
|
|
1561
|
+
/**## ODModalManagerIdConstraint `type`
|
|
1562
|
+
* The constraint/layout for id mappings/interfaces of the `ODModalManager` class.
|
|
1563
|
+
*/
|
|
1564
|
+
export type ODModalManagerIdConstraint = Record<string,{source:string,params:object,workers:string}>
|
|
1565
|
+
|
|
1389
1566
|
/**## ODModalManager `class`
|
|
1390
1567
|
* This is an Open Discord modal manager.
|
|
1391
1568
|
*
|
|
@@ -1393,7 +1570,7 @@ export class ODQuickMessage {
|
|
|
1393
1570
|
*
|
|
1394
1571
|
* It's recommended to use this system in combination with all the other Open Discord builders!
|
|
1395
1572
|
*/
|
|
1396
|
-
export class ODModalManager extends ODManagerWithSafety<ODModal<string,
|
|
1573
|
+
export class ODModalManager<IdList extends ODModalManagerIdConstraint = ODModalManagerIdConstraint> extends ODManagerWithSafety<ODModal<string,{},string>> {
|
|
1397
1574
|
constructor(debug:ODDebugger){
|
|
1398
1575
|
super(() => {
|
|
1399
1576
|
return new ODModal("opendiscord:unknown-modal",(instance,params,source,cancel) => {
|
|
@@ -1411,6 +1588,34 @@ export class ODModalManager extends ODManagerWithSafety<ODModal<string,any>> {
|
|
|
1411
1588
|
})
|
|
1412
1589
|
},debug,"modal")
|
|
1413
1590
|
}
|
|
1591
|
+
|
|
1592
|
+
get<ModalId extends keyof IdList>(id:ModalId): ODModal<IdList[ModalId]["source"],IdList[ModalId]["params"],IdList[ModalId]["workers"]>
|
|
1593
|
+
get(id:ODValidId): ODModal<string,{},string>|null
|
|
1594
|
+
|
|
1595
|
+
get(id:ODValidId): ODModal<string,{},string>|null {
|
|
1596
|
+
return super.get(id)
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
remove<ModalId extends keyof IdList>(id:ModalId): ODModal<IdList[ModalId]["source"],IdList[ModalId]["params"],IdList[ModalId]["workers"]>
|
|
1600
|
+
remove(id:ODValidId): ODModal<string,{},string>|null
|
|
1601
|
+
|
|
1602
|
+
remove(id:ODValidId): ODModal<string,{},string>|null {
|
|
1603
|
+
return super.remove(id)
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
exists(id:keyof IdList): boolean
|
|
1607
|
+
exists(id:ODValidId): boolean
|
|
1608
|
+
|
|
1609
|
+
exists(id:ODValidId): boolean {
|
|
1610
|
+
return super.exists(id)
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
getSafe<ModalId extends keyof IdList>(id:ModalId): ODModal<IdList[ModalId]["source"],IdList[ModalId]["params"],IdList[ModalId]["workers"]>
|
|
1614
|
+
getSafe(id:ODValidId): ODModal<string,{},string>
|
|
1615
|
+
|
|
1616
|
+
getSafe(id:ODValidId): ODModal<string,{},string> {
|
|
1617
|
+
return super.getSafe(id)
|
|
1618
|
+
}
|
|
1414
1619
|
}
|
|
1415
1620
|
|
|
1416
1621
|
/**## ODModalDataQuestion `interface`
|
|
@@ -1512,7 +1717,7 @@ export class ODModalInstance {
|
|
|
1512
1717
|
*
|
|
1513
1718
|
* This is possible by using "workers" or multiple functions that will be executed in priority order!
|
|
1514
1719
|
*/
|
|
1515
|
-
export class ODModal<Source extends string,Params> extends ODBuilderImplementation<ODModalInstance,Source,Params,ODModalBuildResult> {
|
|
1720
|
+
export class ODModal<Source extends string,Params,WorkerIds extends string = string> extends ODBuilderImplementation<ODModalInstance,Source,Params,ODModalBuildResult,WorkerIds> {
|
|
1516
1721
|
/**Build this modal & compile it for discord.js */
|
|
1517
1722
|
async build(source:Source, params:Params){
|
|
1518
1723
|
if (this.didCache && this.cache && this.allowCache) return this.cache
|