@open-discord-bots/framework 0.2.10 → 0.2.12
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/action.d.ts +9 -9
- package/dist/api/modules/action.js +3 -3
- package/dist/api/modules/base.d.ts +5 -3
- package/dist/api/modules/base.js +8 -4
- package/dist/api/modules/builder.d.ts +41 -41
- package/dist/api/modules/builder.js +20 -20
- package/dist/api/modules/checker.d.ts +3 -3
- package/dist/api/modules/client.js +2 -2
- package/dist/api/modules/console.d.ts +15 -15
- package/dist/api/modules/console.js +31 -31
- package/dist/api/modules/event.js +2 -2
- package/dist/api/modules/helpmenu.js +1 -1
- package/dist/api/modules/progressbar.js +1 -0
- package/dist/api/modules/responder.d.ts +37 -37
- package/dist/api/modules/responder.js +13 -13
- package/dist/api/modules/statistic.js +0 -2
- package/dist/api/modules/worker.d.ts +14 -14
- package/dist/api/modules/worker.js +9 -9
- package/dist/cli/editConfig.js +6 -20
- package/dist/startup/pluginLauncher.js +6 -4
- package/dist/utilities/index.d.ts +2 -2
- package/package.json +4 -4
- package/src/api/main.ts +1 -1
- package/src/api/modules/action.ts +10 -10
- package/src/api/modules/base.ts +12 -8
- package/src/api/modules/builder.ts +53 -53
- package/src/api/modules/checker.ts +3 -3
- package/src/api/modules/client.ts +15 -15
- package/src/api/modules/component.txt +350 -0
- package/src/api/modules/config.ts +1 -1
- package/src/api/modules/console.ts +26 -26
- package/src/api/modules/database.ts +1 -1
- package/src/api/modules/event.ts +5 -5
- package/src/api/modules/helpmenu.ts +3 -3
- package/src/api/modules/language.ts +1 -1
- package/src/api/modules/plugin.ts +1 -1
- package/src/api/modules/progressbar.ts +3 -1
- package/src/api/modules/responder.ts +43 -43
- package/src/api/modules/statistic.ts +0 -1
- package/src/api/modules/worker.ts +25 -25
- package/src/cli/editConfig.ts +20 -34
- package/src/startup/compilation.ts +2 -2
- package/src/startup/pluginLauncher.ts +9 -6
- package/src/utilities/index.ts +3 -3
- package/tsconfig.json +1 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ODHTTPGetRequest, ODVersion,
|
|
1
|
+
import { ODHTTPGetRequest, ODVersion, ODManager, ODManagerData, ODValidId, ODNoGeneric } from "./base";
|
|
2
2
|
import { ODMain } from "../main";
|
|
3
3
|
/**## ODValidConsoleColor `type`
|
|
4
4
|
* This is a collection of all the supported console colors within Open Discord.
|
|
@@ -46,52 +46,52 @@ export declare class ODConsoleMessage {
|
|
|
46
46
|
/**Set the prefix color */
|
|
47
47
|
setColor(color: ODValidConsoleColor): this;
|
|
48
48
|
}
|
|
49
|
-
/**##
|
|
49
|
+
/**## ODInfoConsoleMessage `class`
|
|
50
50
|
* This is an Open Discord console info message.
|
|
51
51
|
*
|
|
52
52
|
* It is the same as a normal `ODConsoleMessage`, but it has a predefined prefix & color scheme for the "INFO" messages!
|
|
53
53
|
*/
|
|
54
|
-
export declare class
|
|
54
|
+
export declare class ODInfoConsoleMessage extends ODConsoleMessage {
|
|
55
55
|
constructor(message: string, params?: ODConsoleMessageParam[]);
|
|
56
56
|
}
|
|
57
|
-
/**##
|
|
57
|
+
/**## ODSystemConsoleMessage `class`
|
|
58
58
|
* This is an Open Discord console system message.
|
|
59
59
|
*
|
|
60
60
|
* It is the same as a normal `ODConsoleMessage`, but it has a predefined prefix & color scheme for the "SYSTEM" messages!
|
|
61
61
|
*/
|
|
62
|
-
export declare class
|
|
62
|
+
export declare class ODSystemConsoleMessage extends ODConsoleMessage {
|
|
63
63
|
constructor(message: string, params?: ODConsoleMessageParam[]);
|
|
64
64
|
}
|
|
65
|
-
/**##
|
|
65
|
+
/**## ODPluginConsoleMessage `class`
|
|
66
66
|
* This is an Open Discord console plugin message.
|
|
67
67
|
*
|
|
68
68
|
* It is the same as a normal `ODConsoleMessage`, but it has a predefined prefix & color scheme for the "PLUGIN" messages!
|
|
69
69
|
*/
|
|
70
|
-
export declare class
|
|
70
|
+
export declare class ODPluginConsoleMessage extends ODConsoleMessage {
|
|
71
71
|
constructor(message: string, params?: ODConsoleMessageParam[]);
|
|
72
72
|
}
|
|
73
|
-
/**##
|
|
73
|
+
/**## ODDebugConsoleMessage `class`
|
|
74
74
|
* This is an Open Discord console debug message.
|
|
75
75
|
*
|
|
76
76
|
* It is the same as a normal `ODConsoleMessage`, but it has a predefined prefix & color scheme for the "DEBUG" messages!
|
|
77
77
|
*/
|
|
78
|
-
export declare class
|
|
78
|
+
export declare class ODDebugConsoleMessage extends ODConsoleMessage {
|
|
79
79
|
constructor(message: string, params?: ODConsoleMessageParam[]);
|
|
80
80
|
}
|
|
81
|
-
/**##
|
|
81
|
+
/**## ODWarningConsoleMessage `class`
|
|
82
82
|
* This is an Open Discord console warning message.
|
|
83
83
|
*
|
|
84
84
|
* It is the same as a normal `ODConsoleMessage`, but it has a predefined prefix & color scheme for the "WARNING" messages!
|
|
85
85
|
*/
|
|
86
|
-
export declare class
|
|
86
|
+
export declare class ODWarningConsoleMessage extends ODConsoleMessage {
|
|
87
87
|
constructor(message: string, params?: ODConsoleMessageParam[]);
|
|
88
88
|
}
|
|
89
|
-
/**##
|
|
89
|
+
/**## ODErrorConsoleMessage `class`
|
|
90
90
|
* This is an Open Discord console error message.
|
|
91
91
|
*
|
|
92
92
|
* It is the same as a normal `ODConsoleMessage`, but it has a predefined prefix & color scheme for the "ERROR" messages!
|
|
93
93
|
*/
|
|
94
|
-
export declare class
|
|
94
|
+
export declare class ODErrorConsoleMessage extends ODConsoleMessage {
|
|
95
95
|
constructor(message: string, params?: ODConsoleMessageParam[]);
|
|
96
96
|
}
|
|
97
97
|
/**## ODError `class`
|
|
@@ -101,10 +101,10 @@ export declare class ODConsoleErrorMessage extends ODConsoleMessage {
|
|
|
101
101
|
*/
|
|
102
102
|
export declare class ODError {
|
|
103
103
|
/**The original error that this class wraps around */
|
|
104
|
-
error:
|
|
104
|
+
error: any;
|
|
105
105
|
/**The origin of the original error */
|
|
106
106
|
origin: NodeJS.UncaughtExceptionOrigin;
|
|
107
|
-
constructor(error:
|
|
107
|
+
constructor(error: any, origin: NodeJS.UncaughtExceptionOrigin);
|
|
108
108
|
/**Render this error to the console using `console.log`! Returns `false` when something went wrong. */
|
|
109
109
|
render(): boolean;
|
|
110
110
|
/**Create a more-detailed, non-colored version of this error to store it in the `debug.txt` file! */
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ODLiveStatusRenderer = exports.ODLiveStatusManager = exports.ODLiveStatusUrlSource = exports.ODLiveStatusFileSource = exports.ODLiveStatusSource = exports.ODDebugger = exports.ODDebugFileManager = exports.ODConsoleManager = exports.ODError = exports.
|
|
6
|
+
exports.ODLiveStatusRenderer = exports.ODLiveStatusManager = exports.ODLiveStatusUrlSource = exports.ODLiveStatusFileSource = exports.ODLiveStatusSource = exports.ODDebugger = exports.ODDebugFileManager = exports.ODConsoleManager = exports.ODError = exports.ODErrorConsoleMessage = exports.ODWarningConsoleMessage = exports.ODDebugConsoleMessage = exports.ODPluginConsoleMessage = exports.ODSystemConsoleMessage = exports.ODInfoConsoleMessage = exports.ODConsoleMessage = void 0;
|
|
7
7
|
///////////////////////////////////////
|
|
8
8
|
//CONSOLE MODULE
|
|
9
9
|
///////////////////////////////////////
|
|
@@ -101,72 +101,72 @@ class ODConsoleMessage {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
exports.ODConsoleMessage = ODConsoleMessage;
|
|
104
|
-
/**##
|
|
104
|
+
/**## ODInfoConsoleMessage `class`
|
|
105
105
|
* This is an Open Discord console info message.
|
|
106
106
|
*
|
|
107
107
|
* It is the same as a normal `ODConsoleMessage`, but it has a predefined prefix & color scheme for the "INFO" messages!
|
|
108
108
|
*/
|
|
109
|
-
class
|
|
109
|
+
class ODInfoConsoleMessage extends ODConsoleMessage {
|
|
110
110
|
constructor(message, params) {
|
|
111
111
|
super(message, "INFO", "blue", params);
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
exports.
|
|
115
|
-
/**##
|
|
114
|
+
exports.ODInfoConsoleMessage = ODInfoConsoleMessage;
|
|
115
|
+
/**## ODSystemConsoleMessage `class`
|
|
116
116
|
* This is an Open Discord console system message.
|
|
117
117
|
*
|
|
118
118
|
* It is the same as a normal `ODConsoleMessage`, but it has a predefined prefix & color scheme for the "SYSTEM" messages!
|
|
119
119
|
*/
|
|
120
|
-
class
|
|
120
|
+
class ODSystemConsoleMessage extends ODConsoleMessage {
|
|
121
121
|
constructor(message, params) {
|
|
122
122
|
super(message, "SYSTEM", "green", params);
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
exports.
|
|
126
|
-
/**##
|
|
125
|
+
exports.ODSystemConsoleMessage = ODSystemConsoleMessage;
|
|
126
|
+
/**## ODPluginConsoleMessage `class`
|
|
127
127
|
* This is an Open Discord console plugin message.
|
|
128
128
|
*
|
|
129
129
|
* It is the same as a normal `ODConsoleMessage`, but it has a predefined prefix & color scheme for the "PLUGIN" messages!
|
|
130
130
|
*/
|
|
131
|
-
class
|
|
131
|
+
class ODPluginConsoleMessage extends ODConsoleMessage {
|
|
132
132
|
constructor(message, params) {
|
|
133
133
|
super(message, "PLUGIN", "magenta", params);
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
|
-
exports.
|
|
137
|
-
/**##
|
|
136
|
+
exports.ODPluginConsoleMessage = ODPluginConsoleMessage;
|
|
137
|
+
/**## ODDebugConsoleMessage `class`
|
|
138
138
|
* This is an Open Discord console debug message.
|
|
139
139
|
*
|
|
140
140
|
* It is the same as a normal `ODConsoleMessage`, but it has a predefined prefix & color scheme for the "DEBUG" messages!
|
|
141
141
|
*/
|
|
142
|
-
class
|
|
142
|
+
class ODDebugConsoleMessage extends ODConsoleMessage {
|
|
143
143
|
constructor(message, params) {
|
|
144
144
|
super(message, "DEBUG", "cyan", params);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
|
-
exports.
|
|
148
|
-
/**##
|
|
147
|
+
exports.ODDebugConsoleMessage = ODDebugConsoleMessage;
|
|
148
|
+
/**## ODWarningConsoleMessage `class`
|
|
149
149
|
* This is an Open Discord console warning message.
|
|
150
150
|
*
|
|
151
151
|
* It is the same as a normal `ODConsoleMessage`, but it has a predefined prefix & color scheme for the "WARNING" messages!
|
|
152
152
|
*/
|
|
153
|
-
class
|
|
153
|
+
class ODWarningConsoleMessage extends ODConsoleMessage {
|
|
154
154
|
constructor(message, params) {
|
|
155
155
|
super(message, "WARNING", "yellow", params);
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
|
-
exports.
|
|
159
|
-
/**##
|
|
158
|
+
exports.ODWarningConsoleMessage = ODWarningConsoleMessage;
|
|
159
|
+
/**## ODErrorConsoleMessage `class`
|
|
160
160
|
* This is an Open Discord console error message.
|
|
161
161
|
*
|
|
162
162
|
* It is the same as a normal `ODConsoleMessage`, but it has a predefined prefix & color scheme for the "ERROR" messages!
|
|
163
163
|
*/
|
|
164
|
-
class
|
|
164
|
+
class ODErrorConsoleMessage extends ODConsoleMessage {
|
|
165
165
|
constructor(message, params) {
|
|
166
166
|
super(message, "ERROR", "red", params);
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
exports.
|
|
169
|
+
exports.ODErrorConsoleMessage = ODErrorConsoleMessage;
|
|
170
170
|
/**## ODError `class`
|
|
171
171
|
* This is an Open Discord error.
|
|
172
172
|
*
|
|
@@ -184,7 +184,7 @@ class ODError {
|
|
|
184
184
|
/**Render this error to the console using `console.log`! Returns `false` when something went wrong. */
|
|
185
185
|
render() {
|
|
186
186
|
try {
|
|
187
|
-
let prefix = (this.error["_ODErrorType"] == "plugin") ? "PLUGIN ERROR" : ((this.error["_ODErrorType"] == "system") ? "OPENTICKET ERROR" : "UNKNOWN ERROR");
|
|
187
|
+
let prefix = (this.error["_ODErrorType"] && this.error["_ODErrorType"] == "plugin") ? "PLUGIN ERROR" : ((this.error["_ODErrorType"] == "system") ? "OPENTICKET ERROR" : "UNKNOWN ERROR");
|
|
188
188
|
//title
|
|
189
189
|
console.log(ansis_1.default.red("[" + prefix + "]: ") + this.error.message + " | origin: " + this.origin);
|
|
190
190
|
//stack trace
|
|
@@ -247,19 +247,19 @@ class ODConsoleManager {
|
|
|
247
247
|
else if (["string", "number", "boolean", "object"].includes(typeof message)) {
|
|
248
248
|
let newMessage;
|
|
249
249
|
if (type == "info")
|
|
250
|
-
newMessage = new
|
|
250
|
+
newMessage = new ODInfoConsoleMessage(message, params);
|
|
251
251
|
else if (type == "system")
|
|
252
|
-
newMessage = new
|
|
252
|
+
newMessage = new ODSystemConsoleMessage(message, params);
|
|
253
253
|
else if (type == "plugin")
|
|
254
|
-
newMessage = new
|
|
254
|
+
newMessage = new ODPluginConsoleMessage(message, params);
|
|
255
255
|
else if (type == "debug")
|
|
256
|
-
newMessage = new
|
|
256
|
+
newMessage = new ODDebugConsoleMessage(message, params);
|
|
257
257
|
else if (type == "warning")
|
|
258
|
-
newMessage = new
|
|
258
|
+
newMessage = new ODWarningConsoleMessage(message, params);
|
|
259
259
|
else if (type == "error")
|
|
260
|
-
newMessage = new
|
|
260
|
+
newMessage = new ODErrorConsoleMessage(message, params);
|
|
261
261
|
else
|
|
262
|
-
newMessage = new
|
|
262
|
+
newMessage = new ODSystemConsoleMessage(message, params);
|
|
263
263
|
if (!this.silent)
|
|
264
264
|
newMessage.render();
|
|
265
265
|
if (this.debugfile)
|
|
@@ -405,11 +405,11 @@ class ODDebugger {
|
|
|
405
405
|
/**Create a debug message. This will always be logged to `debug.txt` & sometimes to the console (when enabled). Returns `true` when visible */
|
|
406
406
|
debug(message, params) {
|
|
407
407
|
if (this.visible) {
|
|
408
|
-
this.console.log(new
|
|
408
|
+
this.console.log(new ODDebugConsoleMessage(message, params));
|
|
409
409
|
return true;
|
|
410
410
|
}
|
|
411
411
|
else {
|
|
412
|
-
this.console.debugfile.writeConsoleMessage(new
|
|
412
|
+
this.console.debugfile.writeConsoleMessage(new ODDebugConsoleMessage(message, params));
|
|
413
413
|
return false;
|
|
414
414
|
}
|
|
415
415
|
}
|
|
@@ -593,11 +593,11 @@ class ODLiveStatusRenderer {
|
|
|
593
593
|
if (!["red", "yellow", "green", "blue", "gray", "magenta", "cyan"].includes(titleColor))
|
|
594
594
|
var finalTitle = ansis_1.default.white(title);
|
|
595
595
|
else
|
|
596
|
-
var finalTitle = ansis_1.default[titleColor](title);
|
|
596
|
+
var finalTitle = ansis_1.default[(titleColor == "normal" ? "white" : titleColor)](title);
|
|
597
597
|
if (!["red", "yellow", "green", "blue", "gray", "magenta", "cyan"].includes(descriptionColor))
|
|
598
598
|
var finalDescription = ansis_1.default.white(description);
|
|
599
599
|
else
|
|
600
|
-
var finalDescription = ansis_1.default[descriptionColor](description);
|
|
600
|
+
var finalDescription = ansis_1.default[(descriptionColor == "normal" ? "white" : descriptionColor)](description);
|
|
601
601
|
final.push(finalTitle + finalDescription);
|
|
602
602
|
});
|
|
603
603
|
//return all messages
|
|
@@ -42,7 +42,7 @@ class ODEvent extends base_1.ODManagerData {
|
|
|
42
42
|
this.listeners.push(callback);
|
|
43
43
|
if (this.listeners.length > this.listenerLimit) {
|
|
44
44
|
if (this.#debug)
|
|
45
|
-
this.#debug.console.log(new console_1.
|
|
45
|
+
this.#debug.console.log(new console_1.ODWarningConsoleMessage("Possible event memory leak detected!", [
|
|
46
46
|
{ key: "event", value: this.id.value },
|
|
47
47
|
{ key: "listeners", value: this.listeners.length.toString() }
|
|
48
48
|
]));
|
|
@@ -65,7 +65,7 @@ class ODEvent extends base_1.ODManagerData {
|
|
|
65
65
|
await listener(...params);
|
|
66
66
|
}
|
|
67
67
|
catch (err) {
|
|
68
|
-
process.emit("uncaughtException", err);
|
|
68
|
+
process.emit("uncaughtException", new base_1.ODSystemError(err));
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -95,7 +95,7 @@ class ODHelpMenuCategory extends base_1.ODManager {
|
|
|
95
95
|
result.push(await component.render(page, category, i, mode));
|
|
96
96
|
}
|
|
97
97
|
catch (err) {
|
|
98
|
-
process.emit("uncaughtException", err);
|
|
98
|
+
process.emit("uncaughtException", new base_1.ODSystemError(err));
|
|
99
99
|
}
|
|
100
100
|
i++;
|
|
101
101
|
}
|
|
@@ -88,6 +88,7 @@ class ODProgressBarRenderer extends base_1.ODManagerData {
|
|
|
88
88
|
if (typeof settings[key] != "undefined")
|
|
89
89
|
newSettings[key] = settings[key];
|
|
90
90
|
}
|
|
91
|
+
const idk = Object.keys(settings);
|
|
91
92
|
return new ODProgressBarRenderer(this.id, this.#render, newSettings);
|
|
92
93
|
}
|
|
93
94
|
}
|
|
@@ -11,19 +11,19 @@ import { ODDropdownData, ODMessageBuildResult, ODMessageBuildSentResult, ODModal
|
|
|
11
11
|
*
|
|
12
12
|
* This class can't be used stand-alone & needs to be extended from!
|
|
13
13
|
*/
|
|
14
|
-
export declare class ODResponderImplementation<Instance,
|
|
14
|
+
export declare class ODResponderImplementation<Instance, Origin extends string, Params, WorkerIds extends string = string> extends ODManagerData {
|
|
15
15
|
/**The manager that has all workers of this implementation */
|
|
16
|
-
workers: ODWorkerManager<Instance,
|
|
16
|
+
workers: ODWorkerManager<Instance, Origin, Params, WorkerIds>;
|
|
17
17
|
/**The `commandName` or `customId` needs to match this string or regex for this responder to be executed. */
|
|
18
18
|
match: string | RegExp;
|
|
19
|
-
constructor(id: ODValidId, match: string | RegExp, callback?: ODWorkerCallback<Instance,
|
|
19
|
+
constructor(id: ODValidId, match: string | RegExp, callback?: ODWorkerCallback<Instance, Origin, Params>, priority?: number, callbackId?: ODValidId);
|
|
20
20
|
/**Execute all workers & return the result. */
|
|
21
|
-
respond(instance: Instance,
|
|
21
|
+
respond(instance: Instance, origin: Origin, params: Params): Promise<void>;
|
|
22
22
|
}
|
|
23
23
|
/**## ODResponderTimeoutErrorCallback `type`
|
|
24
24
|
* This is the callback for the responder timeout function. It will be executed when something went wrong or the action takes too much time.
|
|
25
25
|
*/
|
|
26
|
-
export type ODResponderTimeoutErrorCallback<Instance,
|
|
26
|
+
export type ODResponderTimeoutErrorCallback<Instance, Origin extends "slash" | "text" | "button" | "dropdown" | "modal" | "other" | "context-menu" | "autocomplete"> = (instance: Instance, origin: Origin) => void | Promise<void>;
|
|
27
27
|
/**## ODResponderManager `class`
|
|
28
28
|
* This is an Open Discord responder manager.
|
|
29
29
|
*
|
|
@@ -57,7 +57,7 @@ export declare class ODResponderManager<CommandIdList extends ODCommandResponder
|
|
|
57
57
|
* The constraint/layout for id mappings/interfaces of the `ODCommandResponderManager` class.
|
|
58
58
|
*/
|
|
59
59
|
export type ODCommandResponderManagerIdConstraint = Record<string, {
|
|
60
|
-
|
|
60
|
+
origin: "slash" | "text";
|
|
61
61
|
params: object;
|
|
62
62
|
workers: string;
|
|
63
63
|
}>;
|
|
@@ -81,9 +81,9 @@ export declare class ODCommandResponderManager<IdList extends ODCommandResponder
|
|
|
81
81
|
/**Set the message to send when the response times out! */
|
|
82
82
|
setTimeoutErrorCallback(callback: ODResponderTimeoutErrorCallback<ODCommandResponderInstance, "slash" | "text"> | null, ms: number | null): void;
|
|
83
83
|
add(data: ODCommandResponder<"slash" | "text", any>, overwrite?: boolean): boolean;
|
|
84
|
-
get<CommandResponderId extends keyof ODNoGeneric<IdList>>(id: CommandResponderId): ODCommandResponder<IdList[CommandResponderId]["
|
|
84
|
+
get<CommandResponderId extends keyof ODNoGeneric<IdList>>(id: CommandResponderId): ODCommandResponder<IdList[CommandResponderId]["origin"], IdList[CommandResponderId]["params"], IdList[CommandResponderId]["workers"]>;
|
|
85
85
|
get(id: ODValidId): ODCommandResponder<"slash" | "text", any> | null;
|
|
86
|
-
remove<CommandResponderId extends keyof ODNoGeneric<IdList>>(id: CommandResponderId): ODCommandResponder<IdList[CommandResponderId]["
|
|
86
|
+
remove<CommandResponderId extends keyof ODNoGeneric<IdList>>(id: CommandResponderId): ODCommandResponder<IdList[CommandResponderId]["origin"], IdList[CommandResponderId]["params"], IdList[CommandResponderId]["workers"]>;
|
|
87
87
|
remove(id: ODValidId): ODCommandResponder<"slash" | "text", any> | null;
|
|
88
88
|
exists(id: keyof ODNoGeneric<IdList>): boolean;
|
|
89
89
|
exists(id: ODValidId): boolean;
|
|
@@ -162,18 +162,18 @@ export declare class ODCommandResponderInstance {
|
|
|
162
162
|
*
|
|
163
163
|
* This class manages all workers which are executed when the related command is triggered.
|
|
164
164
|
*/
|
|
165
|
-
export declare class ODCommandResponder<
|
|
165
|
+
export declare class ODCommandResponder<Origin extends "slash" | "text", Params, WorkerIds extends string = string> extends ODResponderImplementation<ODCommandResponderInstance, Origin, Params, WorkerIds> {
|
|
166
166
|
/**The prefix of the text command needs to match this */
|
|
167
167
|
prefix: string;
|
|
168
|
-
constructor(id: ODValidId, prefix: string, match: string | RegExp, callback?: ODWorkerCallback<ODCommandResponderInstance,
|
|
168
|
+
constructor(id: ODValidId, prefix: string, match: string | RegExp, callback?: ODWorkerCallback<ODCommandResponderInstance, Origin, Params>, priority?: number, callbackId?: ODValidId);
|
|
169
169
|
/**Respond to this command */
|
|
170
|
-
respond(instance: ODCommandResponderInstance,
|
|
170
|
+
respond(instance: ODCommandResponderInstance, origin: Origin, params: Params): Promise<void>;
|
|
171
171
|
}
|
|
172
172
|
/**## ODButtonResponderManagerIdConstraint `type`
|
|
173
173
|
* The constraint/layout for id mappings/interfaces of the `ODButtonResponderManager` class.
|
|
174
174
|
*/
|
|
175
175
|
export type ODButtonResponderManagerIdConstraint = Record<string, {
|
|
176
|
-
|
|
176
|
+
origin: "button";
|
|
177
177
|
params: object;
|
|
178
178
|
workers: string;
|
|
179
179
|
}>;
|
|
@@ -196,9 +196,9 @@ export declare class ODButtonResponderManager<IdList extends ODButtonResponderMa
|
|
|
196
196
|
/**Set the message to send when the response times out! */
|
|
197
197
|
setTimeoutErrorCallback(callback: ODResponderTimeoutErrorCallback<ODButtonResponderInstance, "button"> | null, ms: number | null): void;
|
|
198
198
|
add(data: ODButtonResponder<"button", any>, overwrite?: boolean): boolean;
|
|
199
|
-
get<ButtonResponderId extends keyof ODNoGeneric<IdList>>(id: ButtonResponderId): ODButtonResponder<IdList[ButtonResponderId]["
|
|
199
|
+
get<ButtonResponderId extends keyof ODNoGeneric<IdList>>(id: ButtonResponderId): ODButtonResponder<IdList[ButtonResponderId]["origin"], IdList[ButtonResponderId]["params"], IdList[ButtonResponderId]["workers"]>;
|
|
200
200
|
get(id: ODValidId): ODButtonResponder<"button", any> | null;
|
|
201
|
-
remove<ButtonResponderId extends keyof ODNoGeneric<IdList>>(id: ButtonResponderId): ODButtonResponder<IdList[ButtonResponderId]["
|
|
201
|
+
remove<ButtonResponderId extends keyof ODNoGeneric<IdList>>(id: ButtonResponderId): ODButtonResponder<IdList[ButtonResponderId]["origin"], IdList[ButtonResponderId]["params"], IdList[ButtonResponderId]["workers"]>;
|
|
202
202
|
remove(id: ODValidId): ODButtonResponder<"button", any> | null;
|
|
203
203
|
exists(id: keyof ODNoGeneric<IdList>): boolean;
|
|
204
204
|
exists(id: ODValidId): boolean;
|
|
@@ -247,15 +247,15 @@ export declare class ODButtonResponderInstance {
|
|
|
247
247
|
*
|
|
248
248
|
* This class manages all workers which are executed when the related button is triggered.
|
|
249
249
|
*/
|
|
250
|
-
export declare class ODButtonResponder<
|
|
250
|
+
export declare class ODButtonResponder<Origin extends string, Params, WorkerIds extends string = string> extends ODResponderImplementation<ODButtonResponderInstance, Origin, Params, WorkerIds> {
|
|
251
251
|
/**Respond to this button */
|
|
252
|
-
respond(instance: ODButtonResponderInstance,
|
|
252
|
+
respond(instance: ODButtonResponderInstance, origin: Origin, params: Params): Promise<void>;
|
|
253
253
|
}
|
|
254
254
|
/**## ODDropdownResponderManagerIdConstraint `type`
|
|
255
255
|
* The constraint/layout for id mappings/interfaces of the `ODDropdownResponderManager` class.
|
|
256
256
|
*/
|
|
257
257
|
export type ODDropdownResponderManagerIdConstraint = Record<string, {
|
|
258
|
-
|
|
258
|
+
origin: "dropdown";
|
|
259
259
|
params: object;
|
|
260
260
|
workers: string;
|
|
261
261
|
}>;
|
|
@@ -278,9 +278,9 @@ export declare class ODDropdownResponderManager<IdList extends ODDropdownRespond
|
|
|
278
278
|
/**Set the message to send when the response times out! */
|
|
279
279
|
setTimeoutErrorCallback(callback: ODResponderTimeoutErrorCallback<ODDropdownResponderInstance, "dropdown"> | null, ms: number | null): void;
|
|
280
280
|
add(data: ODDropdownResponder<"dropdown", any>, overwrite?: boolean): boolean;
|
|
281
|
-
get<DropdownResponderId extends keyof ODNoGeneric<IdList>>(id: DropdownResponderId): ODDropdownResponder<IdList[DropdownResponderId]["
|
|
281
|
+
get<DropdownResponderId extends keyof ODNoGeneric<IdList>>(id: DropdownResponderId): ODDropdownResponder<IdList[DropdownResponderId]["origin"], IdList[DropdownResponderId]["params"], IdList[DropdownResponderId]["workers"]>;
|
|
282
282
|
get(id: ODValidId): ODDropdownResponder<"dropdown", any> | null;
|
|
283
|
-
remove<DropdownResponderId extends keyof ODNoGeneric<IdList>>(id: DropdownResponderId): ODDropdownResponder<IdList[DropdownResponderId]["
|
|
283
|
+
remove<DropdownResponderId extends keyof ODNoGeneric<IdList>>(id: DropdownResponderId): ODDropdownResponder<IdList[DropdownResponderId]["origin"], IdList[DropdownResponderId]["params"], IdList[DropdownResponderId]["workers"]>;
|
|
284
284
|
remove(id: ODValidId): ODDropdownResponder<"dropdown", any> | null;
|
|
285
285
|
exists(id: keyof ODNoGeneric<IdList>): boolean;
|
|
286
286
|
exists(id: ODValidId): boolean;
|
|
@@ -350,15 +350,15 @@ export declare class ODDropdownResponderInstance {
|
|
|
350
350
|
*
|
|
351
351
|
* This class manages all workers which are executed when the related dropdown is triggered.
|
|
352
352
|
*/
|
|
353
|
-
export declare class ODDropdownResponder<
|
|
353
|
+
export declare class ODDropdownResponder<Origin extends string, Params, WorkerIds extends string = string> extends ODResponderImplementation<ODDropdownResponderInstance, Origin, Params, WorkerIds> {
|
|
354
354
|
/**Respond to this dropdown */
|
|
355
|
-
respond(instance: ODDropdownResponderInstance,
|
|
355
|
+
respond(instance: ODDropdownResponderInstance, origin: Origin, params: Params): Promise<void>;
|
|
356
356
|
}
|
|
357
357
|
/**## ODModalResponderManagerIdConstraint `type`
|
|
358
358
|
* The constraint/layout for id mappings/interfaces of the `ODModalResponderManager` class.
|
|
359
359
|
*/
|
|
360
360
|
export type ODModalResponderManagerIdConstraint = Record<string, {
|
|
361
|
-
|
|
361
|
+
origin: "modal";
|
|
362
362
|
params: object;
|
|
363
363
|
workers: string;
|
|
364
364
|
}>;
|
|
@@ -381,9 +381,9 @@ export declare class ODModalResponderManager<IdList extends ODModalResponderMana
|
|
|
381
381
|
/**Set the message to send when the response times out! */
|
|
382
382
|
setTimeoutErrorCallback(callback: ODResponderTimeoutErrorCallback<ODModalResponderInstance, "modal"> | null, ms: number | null): void;
|
|
383
383
|
add(data: ODModalResponder<"modal", any>, overwrite?: boolean): boolean;
|
|
384
|
-
get<ModalResponderId extends keyof ODNoGeneric<IdList>>(id: ModalResponderId): ODModalResponder<IdList[ModalResponderId]["
|
|
384
|
+
get<ModalResponderId extends keyof ODNoGeneric<IdList>>(id: ModalResponderId): ODModalResponder<IdList[ModalResponderId]["origin"], IdList[ModalResponderId]["params"], IdList[ModalResponderId]["workers"]>;
|
|
385
385
|
get(id: ODValidId): ODModalResponder<"modal", any> | null;
|
|
386
|
-
remove<ModalResponderId extends keyof ODNoGeneric<IdList>>(id: ModalResponderId): ODModalResponder<IdList[ModalResponderId]["
|
|
386
|
+
remove<ModalResponderId extends keyof ODNoGeneric<IdList>>(id: ModalResponderId): ODModalResponder<IdList[ModalResponderId]["origin"], IdList[ModalResponderId]["params"], IdList[ModalResponderId]["workers"]>;
|
|
387
387
|
remove(id: ODValidId): ODModalResponder<"modal", any> | null;
|
|
388
388
|
exists(id: keyof ODNoGeneric<IdList>): boolean;
|
|
389
389
|
exists(id: ODValidId): boolean;
|
|
@@ -433,15 +433,15 @@ export declare class ODModalResponderInstance {
|
|
|
433
433
|
*
|
|
434
434
|
* This class manages all workers which are executed when the related modal is triggered.
|
|
435
435
|
*/
|
|
436
|
-
export declare class ODModalResponder<
|
|
436
|
+
export declare class ODModalResponder<Origin extends string, Params, WorkerIds extends string = string> extends ODResponderImplementation<ODModalResponderInstance, Origin, Params, WorkerIds> {
|
|
437
437
|
/**Respond to this modal */
|
|
438
|
-
respond(instance: ODModalResponderInstance,
|
|
438
|
+
respond(instance: ODModalResponderInstance, origin: Origin, params: Params): Promise<void>;
|
|
439
439
|
}
|
|
440
440
|
/**## ODContextMenuResponderManagerIdConstraint `type`
|
|
441
441
|
* The constraint/layout for id mappings/interfaces of the `ODContextMenuResponderManager` class.
|
|
442
442
|
*/
|
|
443
443
|
export type ODContextMenuResponderManagerIdConstraint = Record<string, {
|
|
444
|
-
|
|
444
|
+
origin: "context-menu";
|
|
445
445
|
params: object;
|
|
446
446
|
workers: string;
|
|
447
447
|
}>;
|
|
@@ -464,9 +464,9 @@ export declare class ODContextMenuResponderManager<IdList extends ODContextMenuR
|
|
|
464
464
|
/**Set the message to send when the response times out! */
|
|
465
465
|
setTimeoutErrorCallback(callback: ODResponderTimeoutErrorCallback<ODContextMenuResponderInstance, "context-menu"> | null, ms: number | null): void;
|
|
466
466
|
add(data: ODContextMenuResponder<"context-menu", any>, overwrite?: boolean): boolean;
|
|
467
|
-
get<ModalResponderId extends keyof ODNoGeneric<IdList>>(id: ModalResponderId): ODContextMenuResponder<IdList[ModalResponderId]["
|
|
467
|
+
get<ModalResponderId extends keyof ODNoGeneric<IdList>>(id: ModalResponderId): ODContextMenuResponder<IdList[ModalResponderId]["origin"], IdList[ModalResponderId]["params"], IdList[ModalResponderId]["workers"]>;
|
|
468
468
|
get(id: ODValidId): ODContextMenuResponder<"context-menu", any> | null;
|
|
469
|
-
remove<ModalResponderId extends keyof ODNoGeneric<IdList>>(id: ModalResponderId): ODContextMenuResponder<IdList[ModalResponderId]["
|
|
469
|
+
remove<ModalResponderId extends keyof ODNoGeneric<IdList>>(id: ModalResponderId): ODContextMenuResponder<IdList[ModalResponderId]["origin"], IdList[ModalResponderId]["params"], IdList[ModalResponderId]["workers"]>;
|
|
470
470
|
remove(id: ODValidId): ODContextMenuResponder<"context-menu", any> | null;
|
|
471
471
|
exists(id: keyof ODNoGeneric<IdList>): boolean;
|
|
472
472
|
exists(id: ODValidId): boolean;
|
|
@@ -508,15 +508,15 @@ export declare class ODContextMenuResponderInstance {
|
|
|
508
508
|
*
|
|
509
509
|
* This class manages all workers which are executed when the related context menu is triggered.
|
|
510
510
|
*/
|
|
511
|
-
export declare class ODContextMenuResponder<
|
|
511
|
+
export declare class ODContextMenuResponder<Origin extends string, Params, WorkerIds extends string = string> extends ODResponderImplementation<ODContextMenuResponderInstance, Origin, Params, WorkerIds> {
|
|
512
512
|
/**Respond to this button */
|
|
513
|
-
respond(instance: ODContextMenuResponderInstance,
|
|
513
|
+
respond(instance: ODContextMenuResponderInstance, origin: Origin, params: Params): Promise<void>;
|
|
514
514
|
}
|
|
515
515
|
/**## ODAutocompleteResponderManagerIdConstraint `type`
|
|
516
516
|
* The constraint/layout for id mappings/interfaces of the `ODAutocompleteResponderManager` class.
|
|
517
517
|
*/
|
|
518
518
|
export type ODAutocompleteResponderManagerIdConstraint = Record<string, {
|
|
519
|
-
|
|
519
|
+
origin: "autocomplete";
|
|
520
520
|
params: object;
|
|
521
521
|
workers: string;
|
|
522
522
|
}>;
|
|
@@ -539,9 +539,9 @@ export declare class ODAutocompleteResponderManager<IdList extends ODAutocomplet
|
|
|
539
539
|
/**Set the message to send when the response times out! */
|
|
540
540
|
setTimeoutErrorCallback(callback: ODResponderTimeoutErrorCallback<ODAutocompleteResponderInstance, "autocomplete"> | null, ms: number | null): void;
|
|
541
541
|
add(data: ODAutocompleteResponder<"autocomplete", any>, overwrite?: boolean): boolean;
|
|
542
|
-
get<AutocompleteResponderId extends keyof ODNoGeneric<IdList>>(id: AutocompleteResponderId): ODAutocompleteResponder<IdList[AutocompleteResponderId]["
|
|
542
|
+
get<AutocompleteResponderId extends keyof ODNoGeneric<IdList>>(id: AutocompleteResponderId): ODAutocompleteResponder<IdList[AutocompleteResponderId]["origin"], IdList[AutocompleteResponderId]["params"], IdList[AutocompleteResponderId]["workers"]>;
|
|
543
543
|
get(id: ODValidId): ODAutocompleteResponder<"autocomplete", any> | null;
|
|
544
|
-
remove<AutocompleteResponderId extends keyof ODNoGeneric<IdList>>(id: AutocompleteResponderId): ODAutocompleteResponder<IdList[AutocompleteResponderId]["
|
|
544
|
+
remove<AutocompleteResponderId extends keyof ODNoGeneric<IdList>>(id: AutocompleteResponderId): ODAutocompleteResponder<IdList[AutocompleteResponderId]["origin"], IdList[AutocompleteResponderId]["params"], IdList[AutocompleteResponderId]["workers"]>;
|
|
545
545
|
remove(id: ODValidId): ODAutocompleteResponder<"autocomplete", any> | null;
|
|
546
546
|
exists(id: keyof ODNoGeneric<IdList>): boolean;
|
|
547
547
|
exists(id: ODValidId): boolean;
|
|
@@ -581,10 +581,10 @@ export declare class ODAutocompleteResponderInstance {
|
|
|
581
581
|
*
|
|
582
582
|
* This class manages all workers which are executed when the related autocomplete is triggered.
|
|
583
583
|
*/
|
|
584
|
-
export declare class ODAutocompleteResponder<
|
|
584
|
+
export declare class ODAutocompleteResponder<Origin extends string, Params, WorkerIds extends string = string> extends ODResponderImplementation<ODAutocompleteResponderInstance, Origin, Params, WorkerIds> {
|
|
585
585
|
/**The slash command of the autocomplete should match the following regex. */
|
|
586
586
|
cmdMatch: string | RegExp;
|
|
587
|
-
constructor(id: ODValidId, cmdMatch: string | RegExp, match: string | RegExp, callback?: ODWorkerCallback<ODAutocompleteResponderInstance,
|
|
587
|
+
constructor(id: ODValidId, cmdMatch: string | RegExp, match: string | RegExp, callback?: ODWorkerCallback<ODAutocompleteResponderInstance, Origin, Params>, priority?: number, callbackId?: ODValidId);
|
|
588
588
|
/**Respond to this autocomplete interaction. */
|
|
589
|
-
respond(instance: ODAutocompleteResponderInstance,
|
|
589
|
+
respond(instance: ODAutocompleteResponderInstance, origin: Origin, params: Params): Promise<void>;
|
|
590
590
|
}
|
|
@@ -61,7 +61,7 @@ class ODResponderImplementation extends base_1.ODManagerData {
|
|
|
61
61
|
this.workers.add(new worker_1.ODWorker(callbackId ? callbackId : id, priority ?? 0, callback));
|
|
62
62
|
}
|
|
63
63
|
/**Execute all workers & return the result. */
|
|
64
|
-
async respond(instance,
|
|
64
|
+
async respond(instance, origin, params) {
|
|
65
65
|
throw new base_1.ODSystemError("Tried to build an unimplemented ODResponderImplementation");
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -492,9 +492,9 @@ class ODCommandResponder extends ODResponderImplementation {
|
|
|
492
492
|
this.prefix = prefix;
|
|
493
493
|
}
|
|
494
494
|
/**Respond to this command */
|
|
495
|
-
async respond(instance,
|
|
495
|
+
async respond(instance, origin, params) {
|
|
496
496
|
//wait for workers to finish
|
|
497
|
-
await this.workers.executeWorkers(instance,
|
|
497
|
+
await this.workers.executeWorkers(instance, origin, params);
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
500
|
exports.ODCommandResponder = ODCommandResponder;
|
|
@@ -698,9 +698,9 @@ exports.ODButtonResponderInstance = ODButtonResponderInstance;
|
|
|
698
698
|
*/
|
|
699
699
|
class ODButtonResponder extends ODResponderImplementation {
|
|
700
700
|
/**Respond to this button */
|
|
701
|
-
async respond(instance,
|
|
701
|
+
async respond(instance, origin, params) {
|
|
702
702
|
//wait for workers to finish
|
|
703
|
-
await this.workers.executeWorkers(instance,
|
|
703
|
+
await this.workers.executeWorkers(instance, origin, params);
|
|
704
704
|
}
|
|
705
705
|
}
|
|
706
706
|
exports.ODButtonResponder = ODButtonResponder;
|
|
@@ -1009,9 +1009,9 @@ exports.ODDropdownResponderInstance = ODDropdownResponderInstance;
|
|
|
1009
1009
|
*/
|
|
1010
1010
|
class ODDropdownResponder extends ODResponderImplementation {
|
|
1011
1011
|
/**Respond to this dropdown */
|
|
1012
|
-
async respond(instance,
|
|
1012
|
+
async respond(instance, origin, params) {
|
|
1013
1013
|
//wait for workers to finish
|
|
1014
|
-
await this.workers.executeWorkers(instance,
|
|
1014
|
+
await this.workers.executeWorkers(instance, origin, params);
|
|
1015
1015
|
}
|
|
1016
1016
|
}
|
|
1017
1017
|
exports.ODDropdownResponder = ODDropdownResponder;
|
|
@@ -1196,9 +1196,9 @@ exports.ODModalResponderInstance = ODModalResponderInstance;
|
|
|
1196
1196
|
*/
|
|
1197
1197
|
class ODModalResponder extends ODResponderImplementation {
|
|
1198
1198
|
/**Respond to this modal */
|
|
1199
|
-
async respond(instance,
|
|
1199
|
+
async respond(instance, origin, params) {
|
|
1200
1200
|
//wait for workers to finish
|
|
1201
|
-
await this.workers.executeWorkers(instance,
|
|
1201
|
+
await this.workers.executeWorkers(instance, origin, params);
|
|
1202
1202
|
}
|
|
1203
1203
|
}
|
|
1204
1204
|
exports.ODModalResponder = ODModalResponder;
|
|
@@ -1370,9 +1370,9 @@ exports.ODContextMenuResponderInstance = ODContextMenuResponderInstance;
|
|
|
1370
1370
|
*/
|
|
1371
1371
|
class ODContextMenuResponder extends ODResponderImplementation {
|
|
1372
1372
|
/**Respond to this button */
|
|
1373
|
-
async respond(instance,
|
|
1373
|
+
async respond(instance, origin, params) {
|
|
1374
1374
|
//wait for workers to finish
|
|
1375
|
-
await this.workers.executeWorkers(instance,
|
|
1375
|
+
await this.workers.executeWorkers(instance, origin, params);
|
|
1376
1376
|
}
|
|
1377
1377
|
}
|
|
1378
1378
|
exports.ODContextMenuResponder = ODContextMenuResponder;
|
|
@@ -1510,9 +1510,9 @@ class ODAutocompleteResponder extends ODResponderImplementation {
|
|
|
1510
1510
|
this.cmdMatch = cmdMatch;
|
|
1511
1511
|
}
|
|
1512
1512
|
/**Respond to this autocomplete interaction. */
|
|
1513
|
-
async respond(instance,
|
|
1513
|
+
async respond(instance, origin, params) {
|
|
1514
1514
|
//wait for workers to finish
|
|
1515
|
-
await this.workers.executeWorkers(instance,
|
|
1515
|
+
await this.workers.executeWorkers(instance, origin, params);
|
|
1516
1516
|
}
|
|
1517
1517
|
}
|
|
1518
1518
|
exports.ODAutocompleteResponder = ODAutocompleteResponder;
|