@open-discord-bots/framework 0.3.14 → 0.3.15
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/main.js +1 -1
- package/dist/api/modules/responder.js +50 -26
- package/package.json +1 -1
- package/src/api/index.ts +0 -31
- package/src/api/main.ts +0 -203
- package/src/api/modules/action.ts +0 -89
- package/src/api/modules/base.ts +0 -845
- package/src/api/modules/builder.ts +0 -1755
- package/src/api/modules/checker.ts +0 -1826
- package/src/api/modules/client.ts +0 -2345
- package/src/api/modules/code.ts +0 -84
- package/src/api/modules/component.ts +0 -2000
- package/src/api/modules/config.ts +0 -264
- package/src/api/modules/console.ts +0 -697
- package/src/api/modules/cooldown.ts +0 -369
- package/src/api/modules/database.ts +0 -321
- package/src/api/modules/event.ts +0 -123
- package/src/api/modules/flag.ts +0 -99
- package/src/api/modules/fuse.ts +0 -365
- package/src/api/modules/helpmenu.ts +0 -273
- package/src/api/modules/language.ts +0 -230
- package/src/api/modules/permission.ts +0 -363
- package/src/api/modules/plugin.ts +0 -294
- package/src/api/modules/post.ts +0 -137
- package/src/api/modules/progressbar.ts +0 -370
- package/src/api/modules/responder.ts +0 -1625
- package/src/api/modules/session.ts +0 -181
- package/src/api/modules/startscreen.ts +0 -345
- package/src/api/modules/state.ts +0 -298
- package/src/api/modules/statistic.ts +0 -380
- package/src/api/modules/verifybar.ts +0 -68
- package/src/api/modules/worker.ts +0 -119
- package/src/cli/editConfig.ts +0 -930
- package/src/cli/index.ts +0 -152
- package/src/index.ts +0 -8
- package/src/startup/compilation.ts +0 -204
- package/src/startup/dump.ts +0 -46
- package/src/startup/errorHandling.ts +0 -42
- package/src/startup/pluginLauncher.ts +0 -265
- package/src/utilities/index.ts +0 -229
- package/tools/cleanup.js +0 -2
package/src/api/modules/code.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
///////////////////////////////////////
|
|
2
|
-
//CODE MODULE
|
|
3
|
-
///////////////////////////////////////
|
|
4
|
-
import { ODId, ODManager, ODManagerData, ODNoGeneric, ODValidId } from "./base.js"
|
|
5
|
-
import { ODDebugger } from "./console.js"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/**## ODCode `class`
|
|
9
|
-
* This is an Open Discord code runner.
|
|
10
|
-
*
|
|
11
|
-
* Using this, you're able to execute a function just before the startup screen. (90% of the code is already loaded)
|
|
12
|
-
* You can also specify a priority to change the execution order.
|
|
13
|
-
* In Open Discord, this is used for the following processes:
|
|
14
|
-
* - Autoclose/delete
|
|
15
|
-
* - Database syncronisation (with tickets, statistics & used options)
|
|
16
|
-
* - Panel auto-update
|
|
17
|
-
* - Database Garbage Collection (removing tickets that don't exist anymore)
|
|
18
|
-
* - And more!
|
|
19
|
-
*/
|
|
20
|
-
export class ODCode extends ODManagerData {
|
|
21
|
-
/**The priority of this code */
|
|
22
|
-
priority: number
|
|
23
|
-
/**The main function of this code */
|
|
24
|
-
func: () => void|Promise<void>
|
|
25
|
-
|
|
26
|
-
constructor(id:ODValidId, priority:number, func:() => void|Promise<void>){
|
|
27
|
-
super(id)
|
|
28
|
-
this.priority = priority
|
|
29
|
-
this.func = func
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**## ODCodeManagerIdConstraint `type`
|
|
34
|
-
* The constraint/layout for id mappings/interfaces of the `ODCodeManager` class.
|
|
35
|
-
*/
|
|
36
|
-
export type ODCodeManagerIdConstraint = Record<string,ODCode>
|
|
37
|
-
|
|
38
|
-
/**## ODCodeManager `class`
|
|
39
|
-
* This is an Open Discord code manager.
|
|
40
|
-
*
|
|
41
|
-
* It manages & executes `ODCode`'s in the correct order.
|
|
42
|
-
*
|
|
43
|
-
* Use this to register a function/code which executes just before the startup screen. (90% is already loaded)
|
|
44
|
-
*/
|
|
45
|
-
export class ODCodeManager<IdList extends ODCodeManagerIdConstraint = ODCodeManagerIdConstraint> extends ODManager<ODCode> {
|
|
46
|
-
constructor(debug:ODDebugger){
|
|
47
|
-
super(debug,"code")
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**Execute all `ODCode` functions in order of their priority (high to low). */
|
|
51
|
-
async execute(){
|
|
52
|
-
const derefArray = [...this.getAll()]
|
|
53
|
-
const workers = derefArray.sort((a,b) => b.priority-a.priority)
|
|
54
|
-
|
|
55
|
-
for (const worker of workers){
|
|
56
|
-
try {
|
|
57
|
-
await worker.func()
|
|
58
|
-
}catch(err){
|
|
59
|
-
process.emit("uncaughtException",err)
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
get<CodeId extends keyof ODNoGeneric<IdList>>(id:CodeId): IdList[CodeId]
|
|
65
|
-
get(id:ODValidId): ODCode|null
|
|
66
|
-
|
|
67
|
-
get(id:ODValidId): ODCode|null {
|
|
68
|
-
return super.get(id)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
remove<CodeId extends keyof ODNoGeneric<IdList>>(id:CodeId): IdList[CodeId]
|
|
72
|
-
remove(id:ODValidId): ODCode|null
|
|
73
|
-
|
|
74
|
-
remove(id:ODValidId): ODCode|null {
|
|
75
|
-
return super.remove(id)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
exists(id:keyof ODNoGeneric<IdList>): boolean
|
|
79
|
-
exists(id:ODValidId): boolean
|
|
80
|
-
|
|
81
|
-
exists(id:ODValidId): boolean {
|
|
82
|
-
return super.exists(id)
|
|
83
|
-
}
|
|
84
|
-
}
|