@open-discord-bots/framework 0.2.12 → 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 +3 -3
- package/dist/api/modules/action.js +8 -14
- package/dist/api/modules/base.d.ts +2 -2
- package/dist/api/modules/base.js +14 -63
- package/dist/api/modules/builder.d.ts +3 -3
- package/dist/api/modules/builder.js +61 -122
- package/dist/api/modules/checker.d.ts +4 -4
- 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 +2 -2
- package/dist/api/modules/console.js +45 -67
- 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 +13 -26
- package/dist/api/modules/responder.d.ts +5 -5
- package/dist/api/modules/responder.js +66 -125
- 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 -20
- package/dist/api/modules/verifybar.d.ts +5 -5
- package/dist/api/modules/verifybar.js +6 -11
- package/dist/api/modules/worker.d.ts +1 -1
- package/dist/api/modules/worker.js +6 -11
- package/dist/cli/editConfig.d.ts +2 -2
- package/dist/cli/editConfig.js +189 -229
- 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 +9 -49
- package/dist/utilities/index.d.ts +1 -1
- package/dist/utilities/index.js +20 -71
- package/package.json +2 -1
- package/src/api/index.ts +26 -26
- package/src/api/main.ts +25 -25
- package/src/api/modules/action.ts +3 -3
- package/src/api/modules/base.ts +2 -2
- package/src/api/modules/builder.ts +3 -3
- package/src/api/modules/checker.ts +4 -4
- package/src/api/modules/client.ts +4 -4
- package/src/api/modules/code.ts +2 -2
- package/src/api/modules/component.txt +2 -2
- package/src/api/modules/config.ts +2 -2
- package/src/api/modules/console.ts +2 -2
- package/src/api/modules/cooldown.ts +2 -2
- package/src/api/modules/database.ts +2 -2
- package/src/api/modules/event.ts +2 -2
- package/src/api/modules/flag.ts +2 -2
- package/src/api/modules/helpmenu.ts +2 -2
- package/src/api/modules/language.ts +2 -2
- package/src/api/modules/permission.ts +3 -3
- package/src/api/modules/plugin.ts +3 -3
- package/src/api/modules/post.ts +3 -3
- package/src/api/modules/progressbar.ts +2 -2
- package/src/api/modules/responder.ts +5 -5
- package/src/api/modules/session.ts +2 -2
- package/src/api/modules/startscreen.ts +4 -4
- package/src/api/modules/statistic.ts +3 -3
- package/src/api/modules/verifybar.ts +5 -5
- package/src/api/modules/worker.ts +1 -1
- package/src/cli/editConfig.ts +3 -3
- package/src/cli/index.ts +3 -3
- package/src/index.ts +5 -5
- package/src/startup/compilation.ts +1 -1
- package/src/startup/dump.ts +2 -2
- package/src/startup/errorHandling.ts +2 -2
- package/src/startup/pluginLauncher.ts +2 -2
- package/src/utilities/index.ts +1 -1
- package/tools/cleanup.js +1 -1
- package/tsconfig.json +1 -1
package/dist/api/index.d.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
export * from "./main";
|
|
2
|
-
export * from "./modules/base";
|
|
3
|
-
export * from "./modules/event";
|
|
4
|
-
export * from "./modules/config";
|
|
5
|
-
export * from "./modules/database";
|
|
6
|
-
export * from "./modules/language";
|
|
7
|
-
export * from "./modules/flag";
|
|
8
|
-
export * from "./modules/console";
|
|
9
|
-
export * from "./modules/fuse";
|
|
10
|
-
export * from "./modules/plugin";
|
|
11
|
-
export * from "./modules/checker";
|
|
12
|
-
export * from "./modules/client";
|
|
13
|
-
export * from "./modules/worker";
|
|
14
|
-
export * from "./modules/builder";
|
|
15
|
-
export * from "./modules/responder";
|
|
16
|
-
export * from "./modules/action";
|
|
17
|
-
export * from "./modules/permission";
|
|
18
|
-
export * from "./modules/helpmenu";
|
|
19
|
-
export * from "./modules/session";
|
|
20
|
-
export * from "./modules/statistic";
|
|
21
|
-
export * from "./modules/code";
|
|
22
|
-
export * from "./modules/cooldown";
|
|
23
|
-
export * from "./modules/post";
|
|
24
|
-
export * from "./modules/verifybar";
|
|
25
|
-
export * from "./modules/progressbar";
|
|
26
|
-
export * from "./modules/startscreen";
|
|
1
|
+
export * from "./main.js";
|
|
2
|
+
export * from "./modules/base.js";
|
|
3
|
+
export * from "./modules/event.js";
|
|
4
|
+
export * from "./modules/config.js";
|
|
5
|
+
export * from "./modules/database.js";
|
|
6
|
+
export * from "./modules/language.js";
|
|
7
|
+
export * from "./modules/flag.js";
|
|
8
|
+
export * from "./modules/console.js";
|
|
9
|
+
export * from "./modules/fuse.js";
|
|
10
|
+
export * from "./modules/plugin.js";
|
|
11
|
+
export * from "./modules/checker.js";
|
|
12
|
+
export * from "./modules/client.js";
|
|
13
|
+
export * from "./modules/worker.js";
|
|
14
|
+
export * from "./modules/builder.js";
|
|
15
|
+
export * from "./modules/responder.js";
|
|
16
|
+
export * from "./modules/action.js";
|
|
17
|
+
export * from "./modules/permission.js";
|
|
18
|
+
export * from "./modules/helpmenu.js";
|
|
19
|
+
export * from "./modules/session.js";
|
|
20
|
+
export * from "./modules/statistic.js";
|
|
21
|
+
export * from "./modules/code.js";
|
|
22
|
+
export * from "./modules/cooldown.js";
|
|
23
|
+
export * from "./modules/post.js";
|
|
24
|
+
export * from "./modules/verifybar.js";
|
|
25
|
+
export * from "./modules/progressbar.js";
|
|
26
|
+
export * from "./modules/startscreen.js";
|
package/dist/api/index.js
CHANGED
|
@@ -1,44 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
1
|
//MAIN MODULE
|
|
18
|
-
|
|
2
|
+
export * from "./main.js";
|
|
19
3
|
//BASE MODULES
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
4
|
+
export * from "./modules/base.js";
|
|
5
|
+
export * from "./modules/event.js";
|
|
6
|
+
export * from "./modules/config.js";
|
|
7
|
+
export * from "./modules/database.js";
|
|
8
|
+
export * from "./modules/language.js";
|
|
9
|
+
export * from "./modules/flag.js";
|
|
10
|
+
export * from "./modules/console.js";
|
|
11
|
+
export * from "./modules/fuse.js";
|
|
12
|
+
export * from "./modules/plugin.js";
|
|
13
|
+
export * from "./modules/checker.js";
|
|
14
|
+
export * from "./modules/client.js";
|
|
15
|
+
export * from "./modules/worker.js";
|
|
16
|
+
export * from "./modules/builder.js";
|
|
17
|
+
export * from "./modules/responder.js";
|
|
18
|
+
export * from "./modules/action.js";
|
|
19
|
+
export * from "./modules/permission.js";
|
|
20
|
+
export * from "./modules/helpmenu.js";
|
|
21
|
+
export * from "./modules/session.js";
|
|
22
|
+
export * from "./modules/statistic.js";
|
|
23
|
+
export * from "./modules/code.js";
|
|
24
|
+
export * from "./modules/cooldown.js";
|
|
25
|
+
export * from "./modules/post.js";
|
|
26
|
+
export * from "./modules/verifybar.js";
|
|
27
|
+
export * from "./modules/progressbar.js";
|
|
28
|
+
export * from "./modules/startscreen.js";
|
package/dist/api/main.d.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { ODEnvHelper, ODProjectType, ODVersionManager } from "./modules/base";
|
|
2
|
-
import { ODConsoleManager, ODConsoleMessage, ODConsoleMessageParam, ODConsoleMessageTypes, ODDebugFileManager, ODDebugger, ODError, ODLiveStatusManager } from "./modules/console";
|
|
3
|
-
import { ODCheckerManager } from "./modules/checker";
|
|
4
|
-
import { ODEventManager } from "./modules/event";
|
|
5
|
-
import { ODPluginManager } from "./modules/plugin";
|
|
6
|
-
import { ODFlagManager } from "./modules/flag";
|
|
7
|
-
import { ODProgressBarManager } from "./modules/progressbar";
|
|
8
|
-
import { ODConfigManager } from "./modules/config";
|
|
9
|
-
import { ODDatabaseManager } from "./modules/database";
|
|
10
|
-
import { ODSessionManager } from "./modules/session";
|
|
11
|
-
import { ODLanguageManager } from "./modules/language";
|
|
12
|
-
import { ODBuilderManager } from "./modules/builder";
|
|
13
|
-
import { ODResponderManager } from "./modules/responder";
|
|
14
|
-
import { ODActionManager } from "./modules/action";
|
|
15
|
-
import { ODVerifyBarManager } from "./modules/verifybar";
|
|
16
|
-
import { ODPermissionManager } from "./modules/permission";
|
|
17
|
-
import { ODCooldownManager } from "./modules/cooldown";
|
|
18
|
-
import { ODHelpMenuManager } from "./modules/helpmenu";
|
|
19
|
-
import { ODStatisticManager } from "./modules/statistic";
|
|
20
|
-
import { ODCodeManager } from "./modules/code";
|
|
21
|
-
import { ODPostManager } from "./modules/post";
|
|
22
|
-
import { ODClientManager } from "./modules/client";
|
|
23
|
-
import { ODSharedFuseManager } from "./modules/fuse";
|
|
24
|
-
import { ODStartScreenManager } from "./modules/startscreen";
|
|
1
|
+
import { ODEnvHelper, ODProjectType, ODVersionManager } from "./modules/base.js";
|
|
2
|
+
import { ODConsoleManager, ODConsoleMessage, ODConsoleMessageParam, ODConsoleMessageTypes, ODDebugFileManager, ODDebugger, ODError, ODLiveStatusManager } from "./modules/console.js";
|
|
3
|
+
import { ODCheckerManager } from "./modules/checker.js";
|
|
4
|
+
import { ODEventManager } from "./modules/event.js";
|
|
5
|
+
import { ODPluginManager } from "./modules/plugin.js";
|
|
6
|
+
import { ODFlagManager } from "./modules/flag.js";
|
|
7
|
+
import { ODProgressBarManager } from "./modules/progressbar.js";
|
|
8
|
+
import { ODConfigManager } from "./modules/config.js";
|
|
9
|
+
import { ODDatabaseManager } from "./modules/database.js";
|
|
10
|
+
import { ODSessionManager } from "./modules/session.js";
|
|
11
|
+
import { ODLanguageManager } from "./modules/language.js";
|
|
12
|
+
import { ODBuilderManager } from "./modules/builder.js";
|
|
13
|
+
import { ODResponderManager } from "./modules/responder.js";
|
|
14
|
+
import { ODActionManager } from "./modules/action.js";
|
|
15
|
+
import { ODVerifyBarManager } from "./modules/verifybar.js";
|
|
16
|
+
import { ODPermissionManager } from "./modules/permission.js";
|
|
17
|
+
import { ODCooldownManager } from "./modules/cooldown.js";
|
|
18
|
+
import { ODHelpMenuManager } from "./modules/helpmenu.js";
|
|
19
|
+
import { ODStatisticManager } from "./modules/statistic.js";
|
|
20
|
+
import { ODCodeManager } from "./modules/code.js";
|
|
21
|
+
import { ODPostManager } from "./modules/post.js";
|
|
22
|
+
import { ODClientManager } from "./modules/client.js";
|
|
23
|
+
import { ODSharedFuseManager } from "./modules/fuse.js";
|
|
24
|
+
import { ODStartScreenManager } from "./modules/startscreen.js";
|
|
25
25
|
/**## ODMainManagers `interface`
|
|
26
26
|
* The global properties for the main class of the bot.
|
|
27
27
|
*/
|
package/dist/api/main.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ODMain = void 0;
|
|
4
1
|
//BASE MODULES
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { ODVersion } from "./modules/base.js";
|
|
3
|
+
import { ODConsoleMessage, ODError } from "./modules/console.js";
|
|
7
4
|
/**## ODMain `class`
|
|
8
5
|
* This is the main Open Discord class.
|
|
9
6
|
* It contains all managers from the entire bot & has shortcuts to the event & logging system.
|
|
10
7
|
*
|
|
11
8
|
* This class can't be overwritten or extended & is available as the global variable `opendiscord`!
|
|
12
9
|
*/
|
|
13
|
-
class ODMain {
|
|
10
|
+
export class ODMain {
|
|
14
11
|
project;
|
|
15
12
|
versions;
|
|
16
13
|
processStartupDate = new Date();
|
|
@@ -45,8 +42,8 @@ class ODMain {
|
|
|
45
42
|
constructor(managers, project) {
|
|
46
43
|
this.project = project;
|
|
47
44
|
this.versions = managers.versions;
|
|
48
|
-
this.versions.add(
|
|
49
|
-
this.versions.add(
|
|
45
|
+
this.versions.add(ODVersion.fromString("opendiscord:api", "v0.2.13"));
|
|
46
|
+
this.versions.add(ODVersion.fromString("opendiscord:livestatus", "v2.0.0"));
|
|
50
47
|
this.debugfile = managers.debugfile;
|
|
51
48
|
this.console = managers.console;
|
|
52
49
|
this.debug = managers.debug;
|
|
@@ -76,12 +73,11 @@ class ODMain {
|
|
|
76
73
|
this.startscreen = managers.startscreen;
|
|
77
74
|
}
|
|
78
75
|
log(message, type, params) {
|
|
79
|
-
if (message instanceof
|
|
76
|
+
if (message instanceof ODConsoleMessage)
|
|
80
77
|
this.console.log(message);
|
|
81
|
-
else if (message instanceof
|
|
78
|
+
else if (message instanceof ODError)
|
|
82
79
|
this.console.log(message);
|
|
83
80
|
else if (["string", "number", "boolean", "object"].includes(typeof message))
|
|
84
81
|
this.console.log(message, type, params);
|
|
85
82
|
}
|
|
86
83
|
}
|
|
87
|
-
exports.ODMain = ODMain;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ODManager, ODValidId, ODManagerData, ODNoGeneric } from "./base";
|
|
2
|
-
import { ODWorkerManager, ODWorkerCallback } from "./worker";
|
|
3
|
-
import { ODDebugger } from "./console";
|
|
1
|
+
import { ODManager, ODValidId, ODManagerData, ODNoGeneric } from "./base.js";
|
|
2
|
+
import { ODWorkerManager, ODWorkerCallback } from "./worker.js";
|
|
3
|
+
import { ODDebugger } from "./console.js";
|
|
4
4
|
/**## ODActionImplementation `class`
|
|
5
5
|
* This is an Open Discord action implementation.
|
|
6
6
|
*
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ODAction = exports.ODActionManager = exports.ODActionImplementation = void 0;
|
|
4
1
|
///////////////////////////////////////
|
|
5
2
|
//ACTION MODULE
|
|
6
3
|
///////////////////////////////////////
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import { ODManager, ODSystemError, ODManagerData } from "./base.js";
|
|
5
|
+
import { ODWorkerManager, ODWorker } from "./worker.js";
|
|
9
6
|
/**## ODActionImplementation `class`
|
|
10
7
|
* This is an Open Discord action implementation.
|
|
11
8
|
*
|
|
@@ -13,21 +10,20 @@ const worker_1 = require("./worker");
|
|
|
13
10
|
*
|
|
14
11
|
* This class can't be used stand-alone & needs to be extended from!
|
|
15
12
|
*/
|
|
16
|
-
class ODActionImplementation extends
|
|
13
|
+
export class ODActionImplementation extends ODManagerData {
|
|
17
14
|
/**The manager that has all workers of this implementation */
|
|
18
15
|
workers;
|
|
19
16
|
constructor(id, callback, priority, callbackId) {
|
|
20
17
|
super(id);
|
|
21
|
-
this.workers = new
|
|
18
|
+
this.workers = new ODWorkerManager("descending");
|
|
22
19
|
if (callback)
|
|
23
|
-
this.workers.add(new
|
|
20
|
+
this.workers.add(new ODWorker(callbackId ? callbackId : id, priority ?? 0, callback));
|
|
24
21
|
}
|
|
25
22
|
/**Execute all workers & return the result. */
|
|
26
23
|
async run(origin, params) {
|
|
27
|
-
throw new
|
|
24
|
+
throw new ODSystemError("Tried to build an unimplemented ODResponderImplementation");
|
|
28
25
|
}
|
|
29
26
|
}
|
|
30
|
-
exports.ODActionImplementation = ODActionImplementation;
|
|
31
27
|
/**## ODActionManager `class`
|
|
32
28
|
* This is an Open Discord action manager.
|
|
33
29
|
*
|
|
@@ -38,7 +34,7 @@ exports.ODActionImplementation = ODActionImplementation;
|
|
|
38
34
|
*
|
|
39
35
|
* It's recommended to use this system in combination with Open Discord responders!
|
|
40
36
|
*/
|
|
41
|
-
class ODActionManager extends
|
|
37
|
+
export class ODActionManager extends ODManager {
|
|
42
38
|
constructor(debug) {
|
|
43
39
|
super(debug, "action");
|
|
44
40
|
}
|
|
@@ -52,7 +48,6 @@ class ODActionManager extends base_1.ODManager {
|
|
|
52
48
|
return super.exists(id);
|
|
53
49
|
}
|
|
54
50
|
}
|
|
55
|
-
exports.ODActionManager = ODActionManager;
|
|
56
51
|
/**## ODAction `class`
|
|
57
52
|
* This is an Open Discord action.
|
|
58
53
|
*
|
|
@@ -60,7 +55,7 @@ exports.ODActionManager = ODActionManager;
|
|
|
60
55
|
*
|
|
61
56
|
* Can be used standalone.
|
|
62
57
|
*/
|
|
63
|
-
class ODAction extends ODActionImplementation {
|
|
58
|
+
export class ODAction extends ODActionImplementation {
|
|
64
59
|
/**Run this action */
|
|
65
60
|
async run(origin, params) {
|
|
66
61
|
//create instance
|
|
@@ -71,4 +66,3 @@ class ODAction extends ODActionImplementation {
|
|
|
71
66
|
return instance;
|
|
72
67
|
}
|
|
73
68
|
}
|
|
74
|
-
exports.ODAction = ODAction;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ODDebugger } from "./console";
|
|
2
|
-
import type { ODMain } from "../main";
|
|
1
|
+
import { ODDebugger } from "./console.js";
|
|
2
|
+
import type { ODMain } from "../main.js";
|
|
3
3
|
/**## ODPromiseVoid `type`
|
|
4
4
|
* This is a simple type to represent a callback return value that could be a promise or not.
|
|
5
5
|
*/
|
package/dist/api/modules/base.js
CHANGED
|
@@ -1,43 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.ODPluginError = exports.ODSystemError = exports.ODEnvHelper = exports.ODHTTPPostRequest = exports.ODHTTPGetRequest = exports.ODVersionMigration = exports.ODVersion = exports.ODVersionManager = exports.ODManagerWithSafety = exports.ODManager = exports.ODManagerData = exports.ODManagerChangeHelper = exports.ODId = void 0;
|
|
37
1
|
///////////////////////////////////////
|
|
38
2
|
//BASE MODULE
|
|
39
3
|
///////////////////////////////////////
|
|
40
|
-
|
|
4
|
+
import * as fs from "fs";
|
|
41
5
|
/**## ODId `class`
|
|
42
6
|
* This is an Open Discord identifier.
|
|
43
7
|
*
|
|
@@ -45,7 +9,7 @@ const fs = __importStar(require("fs"));
|
|
|
45
9
|
*
|
|
46
10
|
* You can use this class to assign a unique id when creating configs, databases, languages & more!
|
|
47
11
|
*/
|
|
48
|
-
class ODId {
|
|
12
|
+
export class ODId {
|
|
49
13
|
/**The full value of this `ODId` as a `string`. */
|
|
50
14
|
#value;
|
|
51
15
|
/**The full value of this `ODId` as a `string`. */
|
|
@@ -119,14 +83,13 @@ class ODId {
|
|
|
119
83
|
this.#change = callback;
|
|
120
84
|
}
|
|
121
85
|
}
|
|
122
|
-
exports.ODId = ODId;
|
|
123
86
|
/**## ODManagerChangeHelper `class`
|
|
124
87
|
* This is an Open Discord manager change helper.
|
|
125
88
|
*
|
|
126
89
|
* It is used to let the "onChange" event in the `ODManager` class work.
|
|
127
90
|
* You can use this class when extending your own `ODManager`
|
|
128
91
|
*/
|
|
129
|
-
class ODManagerChangeHelper {
|
|
92
|
+
export class ODManagerChangeHelper {
|
|
130
93
|
#change = null;
|
|
131
94
|
/**Trigger an `onChange()` event in the parent `ODManager` of this class. */
|
|
132
95
|
_change() {
|
|
@@ -145,7 +108,6 @@ class ODManagerChangeHelper {
|
|
|
145
108
|
this.#change = callback;
|
|
146
109
|
}
|
|
147
110
|
}
|
|
148
|
-
exports.ODManagerChangeHelper = ODManagerChangeHelper;
|
|
149
111
|
/**## ODManagerData `class`
|
|
150
112
|
* This is Open Discord manager data.
|
|
151
113
|
*
|
|
@@ -153,7 +115,7 @@ exports.ODManagerChangeHelper = ODManagerChangeHelper;
|
|
|
153
115
|
*
|
|
154
116
|
* There is an `id:ODId` property & also some events used in the manager.
|
|
155
117
|
*/
|
|
156
|
-
class ODManagerData extends ODManagerChangeHelper {
|
|
118
|
+
export class ODManagerData extends ODManagerChangeHelper {
|
|
157
119
|
/**The id of this data. */
|
|
158
120
|
id;
|
|
159
121
|
constructor(id) {
|
|
@@ -163,7 +125,6 @@ class ODManagerData extends ODManagerChangeHelper {
|
|
|
163
125
|
this.id = new ODId(id);
|
|
164
126
|
}
|
|
165
127
|
}
|
|
166
|
-
exports.ODManagerData = ODManagerData;
|
|
167
128
|
/**## ODManager `class`
|
|
168
129
|
* This is an Open Discord manager.
|
|
169
130
|
*
|
|
@@ -173,7 +134,7 @@ exports.ODManagerData = ODManagerData;
|
|
|
173
134
|
*
|
|
174
135
|
* This class has many useful functions based on `ODId` (add, get, remove, getAll, getFiltered, exists, loopAll, ...)
|
|
175
136
|
*/
|
|
176
|
-
class ODManager extends ODManagerChangeHelper {
|
|
137
|
+
export class ODManager extends ODManagerChangeHelper {
|
|
177
138
|
/**Alias to Open Discord debugger. */
|
|
178
139
|
#debug;
|
|
179
140
|
/**The message to send when debugging this manager. */
|
|
@@ -339,14 +300,13 @@ class ODManager extends ODManagerChangeHelper {
|
|
|
339
300
|
this.#removeListeners.push(callback);
|
|
340
301
|
}
|
|
341
302
|
}
|
|
342
|
-
exports.ODManager = ODManager;
|
|
343
303
|
/**## ODManagerWithSafety `class`
|
|
344
304
|
* This is an Open Discord safe manager.
|
|
345
305
|
*
|
|
346
306
|
* It functions exactly the same as a normal `ODManager`, but it has 1 function extra!
|
|
347
307
|
* The `getSafe()` function will always return data, because when it doesn't find an id, it returns pre-configured backup data.
|
|
348
308
|
*/
|
|
349
|
-
class ODManagerWithSafety extends ODManager {
|
|
309
|
+
export class ODManagerWithSafety extends ODManager {
|
|
350
310
|
/**The function that creates backup data returned in `getSafe()` when an id is missing in this manager. */
|
|
351
311
|
#backupCreator;
|
|
352
312
|
/** Temporary storage for manager debug name. */
|
|
@@ -371,13 +331,12 @@ class ODManagerWithSafety extends ODManager {
|
|
|
371
331
|
return data;
|
|
372
332
|
}
|
|
373
333
|
}
|
|
374
|
-
exports.ODManagerWithSafety = ODManagerWithSafety;
|
|
375
334
|
/**## ODVersionManager `class`
|
|
376
335
|
* A Open Discord version manager.
|
|
377
336
|
*
|
|
378
337
|
* It is used to manage different `ODVersion`'s from the bot. You will use it to check which version of the bot is used.
|
|
379
338
|
*/
|
|
380
|
-
class ODVersionManager extends ODManager {
|
|
339
|
+
export class ODVersionManager extends ODManager {
|
|
381
340
|
constructor() {
|
|
382
341
|
super();
|
|
383
342
|
}
|
|
@@ -391,7 +350,6 @@ class ODVersionManager extends ODManager {
|
|
|
391
350
|
return super.exists(id);
|
|
392
351
|
}
|
|
393
352
|
}
|
|
394
|
-
exports.ODVersionManager = ODVersionManager;
|
|
395
353
|
/**## ODVersion `class`
|
|
396
354
|
* This is an Open Discord version.
|
|
397
355
|
*
|
|
@@ -399,7 +357,7 @@ exports.ODVersionManager = ODVersionManager;
|
|
|
399
357
|
*
|
|
400
358
|
* You can use it in your own plugin, but most of the time you will use it to check the Open Discord version!
|
|
401
359
|
*/
|
|
402
|
-
class ODVersion extends ODManagerData {
|
|
360
|
+
export class ODVersion extends ODManagerData {
|
|
403
361
|
/**The first number of the version (example: `v1.2.3` => `1`) */
|
|
404
362
|
primary;
|
|
405
363
|
/**The second number of the version (example: `v1.2.3` => `2`) */
|
|
@@ -542,13 +500,12 @@ class ODVersion extends ODManagerData {
|
|
|
542
500
|
return (this.primary == requirement.primary && this.secondary == requirement.secondary && this.tertiary == requirement.tertiary);
|
|
543
501
|
}
|
|
544
502
|
}
|
|
545
|
-
exports.ODVersion = ODVersion;
|
|
546
503
|
/**## ODVersionMigration `class`
|
|
547
504
|
* This class is used to manage data migration between Open Ticket versions.
|
|
548
505
|
*
|
|
549
506
|
* It shouldn't be used by plugins because this is an internal API feature!
|
|
550
507
|
*/
|
|
551
|
-
class ODVersionMigration {
|
|
508
|
+
export class ODVersionMigration {
|
|
552
509
|
/**The version to migrate data to */
|
|
553
510
|
version;
|
|
554
511
|
/**The migration function */
|
|
@@ -583,7 +540,6 @@ class ODVersionMigration {
|
|
|
583
540
|
}
|
|
584
541
|
}
|
|
585
542
|
}
|
|
586
|
-
exports.ODVersionMigration = ODVersionMigration;
|
|
587
543
|
/**## ODHTTPGetRequest `class`
|
|
588
544
|
* This is a class that can help you with creating simple HTTP GET requests.
|
|
589
545
|
*
|
|
@@ -596,7 +552,7 @@ exports.ODVersionMigration = ODVersionMigration;
|
|
|
596
552
|
* result.status //the response code (number)
|
|
597
553
|
* result.response //the full response (object)
|
|
598
554
|
*/
|
|
599
|
-
class ODHTTPGetRequest {
|
|
555
|
+
export class ODHTTPGetRequest {
|
|
600
556
|
/**The url used in the request */
|
|
601
557
|
url;
|
|
602
558
|
/**The request config for additional options */
|
|
@@ -644,7 +600,6 @@ class ODHTTPGetRequest {
|
|
|
644
600
|
});
|
|
645
601
|
}
|
|
646
602
|
}
|
|
647
|
-
exports.ODHTTPGetRequest = ODHTTPGetRequest;
|
|
648
603
|
/**## ODHTTPPostRequest `class`
|
|
649
604
|
* This is a class that can help you with creating simple HTTP POST requests.
|
|
650
605
|
*
|
|
@@ -657,7 +612,7 @@ exports.ODHTTPGetRequest = ODHTTPGetRequest;
|
|
|
657
612
|
* result.status //the response code (number)
|
|
658
613
|
* result.response //the full response (object)
|
|
659
614
|
*/
|
|
660
|
-
class ODHTTPPostRequest {
|
|
615
|
+
export class ODHTTPPostRequest {
|
|
661
616
|
/**The url used in the request */
|
|
662
617
|
url;
|
|
663
618
|
/**The request config for additional options */
|
|
@@ -705,7 +660,6 @@ class ODHTTPPostRequest {
|
|
|
705
660
|
});
|
|
706
661
|
}
|
|
707
662
|
}
|
|
708
|
-
exports.ODHTTPPostRequest = ODHTTPPostRequest;
|
|
709
663
|
/**## ODEnvHelper `class`
|
|
710
664
|
* This is a utility class that helps you with reading the ENV.
|
|
711
665
|
*
|
|
@@ -717,7 +671,7 @@ exports.ODHTTPPostRequest = ODHTTPPostRequest;
|
|
|
717
671
|
* const variableB = envHelper.getVariable("value-b","dotenv") //only get from .env
|
|
718
672
|
* const variableA = envHelper.getVariable("value-c","env") //only get from process.env
|
|
719
673
|
*/
|
|
720
|
-
class ODEnvHelper {
|
|
674
|
+
export class ODEnvHelper {
|
|
721
675
|
/**All variables found in the `.env` file */
|
|
722
676
|
dotenv;
|
|
723
677
|
/**All variables found in `process.env` */
|
|
@@ -781,13 +735,12 @@ class ODEnvHelper {
|
|
|
781
735
|
return obj;
|
|
782
736
|
}
|
|
783
737
|
}
|
|
784
|
-
exports.ODEnvHelper = ODEnvHelper;
|
|
785
738
|
/**## ODSystemError `class`
|
|
786
739
|
* A wrapper for the node.js `Error` class that makes the error look better in the console!
|
|
787
740
|
*
|
|
788
741
|
* This wrapper is made for Open Discord system errors! **It can only be used by Open Discord itself!**
|
|
789
742
|
*/
|
|
790
|
-
class ODSystemError extends Error {
|
|
743
|
+
export class ODSystemError extends Error {
|
|
791
744
|
/**This variable gets detected by the error handling system to know how to render it */
|
|
792
745
|
_ODErrorType = "system";
|
|
793
746
|
/**Create an `ODSystemError` directly from an `Error` class */
|
|
@@ -798,13 +751,12 @@ class ODSystemError extends Error {
|
|
|
798
751
|
return modifiedErr;
|
|
799
752
|
}
|
|
800
753
|
}
|
|
801
|
-
exports.ODSystemError = ODSystemError;
|
|
802
754
|
/**## ODPluginError `class`
|
|
803
755
|
* A wrapper for the node.js `Error` class that makes the error look better in the console!
|
|
804
756
|
*
|
|
805
757
|
* This wrapper is made for Open Discord plugin errors! **It can only be used by plugins!**
|
|
806
758
|
*/
|
|
807
|
-
class ODPluginError extends Error {
|
|
759
|
+
export class ODPluginError extends Error {
|
|
808
760
|
/**This variable gets detected by the error handling system to know how to render it */
|
|
809
761
|
_ODErrorType = "plugin";
|
|
810
762
|
/**Create an `ODPluginError` directly from an `Error` class */
|
|
@@ -815,4 +767,3 @@ class ODPluginError extends Error {
|
|
|
815
767
|
return modifiedErr;
|
|
816
768
|
}
|
|
817
769
|
}
|
|
818
|
-
exports.ODPluginError = ODPluginError;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ODId, ODValidButtonColor, ODValidId, ODInterfaceWithPartialProperty, ODManagerWithSafety, ODManagerData, ODNoGeneric } from "./base";
|
|
1
|
+
import { ODId, ODValidButtonColor, ODValidId, ODInterfaceWithPartialProperty, ODManagerWithSafety, ODManagerData, ODNoGeneric } from "./base.js";
|
|
2
2
|
import * as discord from "discord.js";
|
|
3
|
-
import { ODWorkerManager, ODWorkerCallback } from "./worker";
|
|
4
|
-
import { ODDebugger } from "./console";
|
|
3
|
+
import { ODWorkerManager, ODWorkerCallback } from "./worker.js";
|
|
4
|
+
import { ODDebugger } from "./console.js";
|
|
5
5
|
/**## ODBuilderImplementation `class`
|
|
6
6
|
* This is an Open Discord builder implementation.
|
|
7
7
|
*
|