@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.
Files changed (41) hide show
  1. package/dist/api/main.js +1 -1
  2. package/dist/api/modules/responder.js +50 -26
  3. package/package.json +1 -1
  4. package/src/api/index.ts +0 -31
  5. package/src/api/main.ts +0 -203
  6. package/src/api/modules/action.ts +0 -89
  7. package/src/api/modules/base.ts +0 -845
  8. package/src/api/modules/builder.ts +0 -1755
  9. package/src/api/modules/checker.ts +0 -1826
  10. package/src/api/modules/client.ts +0 -2345
  11. package/src/api/modules/code.ts +0 -84
  12. package/src/api/modules/component.ts +0 -2000
  13. package/src/api/modules/config.ts +0 -264
  14. package/src/api/modules/console.ts +0 -697
  15. package/src/api/modules/cooldown.ts +0 -369
  16. package/src/api/modules/database.ts +0 -321
  17. package/src/api/modules/event.ts +0 -123
  18. package/src/api/modules/flag.ts +0 -99
  19. package/src/api/modules/fuse.ts +0 -365
  20. package/src/api/modules/helpmenu.ts +0 -273
  21. package/src/api/modules/language.ts +0 -230
  22. package/src/api/modules/permission.ts +0 -363
  23. package/src/api/modules/plugin.ts +0 -294
  24. package/src/api/modules/post.ts +0 -137
  25. package/src/api/modules/progressbar.ts +0 -370
  26. package/src/api/modules/responder.ts +0 -1625
  27. package/src/api/modules/session.ts +0 -181
  28. package/src/api/modules/startscreen.ts +0 -345
  29. package/src/api/modules/state.ts +0 -298
  30. package/src/api/modules/statistic.ts +0 -380
  31. package/src/api/modules/verifybar.ts +0 -68
  32. package/src/api/modules/worker.ts +0 -119
  33. package/src/cli/editConfig.ts +0 -930
  34. package/src/cli/index.ts +0 -152
  35. package/src/index.ts +0 -8
  36. package/src/startup/compilation.ts +0 -204
  37. package/src/startup/dump.ts +0 -46
  38. package/src/startup/errorHandling.ts +0 -42
  39. package/src/startup/pluginLauncher.ts +0 -265
  40. package/src/utilities/index.ts +0 -229
  41. package/tools/cleanup.js +0 -2
@@ -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
- }