@open-discord-bots/framework 2.0.1 → 2.0.3
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
CHANGED
|
@@ -44,7 +44,7 @@ export class ODMain {
|
|
|
44
44
|
constructor(managers, project) {
|
|
45
45
|
this.project = project;
|
|
46
46
|
this.versions = managers.versions;
|
|
47
|
-
this.versions.add(ODVersion.fromString("opendiscord:api", "v2.0.
|
|
47
|
+
this.versions.add(ODVersion.fromString("opendiscord:api", "v2.0.3"));
|
|
48
48
|
this.versions.add(ODVersion.fromString("opendiscord:livestatus", "v2.0.0"));
|
|
49
49
|
this.debugfile = managers.debugfile;
|
|
50
50
|
this.console = managers.console;
|
|
@@ -27,8 +27,10 @@ export declare class ODComponentFactory<Component extends ODComponent<object, an
|
|
|
27
27
|
/**A collection of all workers for this component factory. */
|
|
28
28
|
workers: ODWorkerManager<ODComponentFactoryInstance<Component>, Origin, Params, WorkerIds>;
|
|
29
29
|
constructor(id: ODValidId, callback?: ODWorkerCallback<ODComponentFactoryInstance<Component>, Origin, Params>, priority?: number, callbackId?: ODValidId);
|
|
30
|
-
/**Run all workers and return the resulting
|
|
30
|
+
/**Run all workers and return the resulting discord.js builder. */
|
|
31
31
|
build(origin: Origin, params: Params): Promise<ODComponentInferBuildResult<Component>>;
|
|
32
|
+
/**Run all workers and return the resulting Open Discord `ODComponent`. */
|
|
33
|
+
buildComponent(origin: Origin, params: Params): Promise<Component>;
|
|
32
34
|
/**Duplicate this component factory. Warning: If workers access external variables (outside parameters), the clone will still use those variables. This might result in unexpected behaviour! */
|
|
33
35
|
duplicate(newId?: ODValidId): ODComponentFactory<Component, Origin, Params, WorkerIds>;
|
|
34
36
|
}
|
|
@@ -38,7 +38,7 @@ export class ODComponentFactory extends ODManagerData {
|
|
|
38
38
|
if (callback)
|
|
39
39
|
this.workers.add(new ODWorker(callbackId ? callbackId : id, priority ?? 0, callback));
|
|
40
40
|
}
|
|
41
|
-
/**Run all workers and return the resulting
|
|
41
|
+
/**Run all workers and return the resulting discord.js builder. */
|
|
42
42
|
async build(origin, params) {
|
|
43
43
|
const instance = new ODComponentFactoryInstance();
|
|
44
44
|
await this.workers.executeWorkers(instance, origin, params);
|
|
@@ -47,6 +47,15 @@ export class ODComponentFactory extends ODManagerData {
|
|
|
47
47
|
throw new ODSystemError("ODComponentFactory.build() --> Failed to build component! (id: " + this.id.value + ")");
|
|
48
48
|
return rootComponent.build();
|
|
49
49
|
}
|
|
50
|
+
/**Run all workers and return the resulting Open Discord `ODComponent`. */
|
|
51
|
+
async buildComponent(origin, params) {
|
|
52
|
+
const instance = new ODComponentFactoryInstance();
|
|
53
|
+
await this.workers.executeWorkers(instance, origin, params);
|
|
54
|
+
const rootComponent = instance.getComponent();
|
|
55
|
+
if (!rootComponent)
|
|
56
|
+
throw new ODSystemError("ODComponentFactory.component() --> Failed to build component! (id: " + this.id.value + ")");
|
|
57
|
+
return rootComponent;
|
|
58
|
+
}
|
|
50
59
|
/**Duplicate this component factory. Warning: If workers access external variables (outside parameters), the clone will still use those variables. This might result in unexpected behaviour! */
|
|
51
60
|
duplicate(newId) {
|
|
52
61
|
const newMessage = new ODComponentFactory(newId ?? this.id.value);
|
|
@@ -631,7 +631,7 @@ export class ODButtonResponderInstance extends ODBaseResponderInstance {
|
|
|
631
631
|
if (this.interaction.replied || this.interaction.deferred) {
|
|
632
632
|
const sent = await this.interaction.editReply(finalMessage);
|
|
633
633
|
this.ignoreResponderTimeout = true;
|
|
634
|
-
return { success: true, message:
|
|
634
|
+
return { success: true, message: sent, ephemeral: build.ephemeral };
|
|
635
635
|
}
|
|
636
636
|
else {
|
|
637
637
|
const sent = await this.interaction.update(finalMessage);
|
|
@@ -972,7 +972,7 @@ export class ODDropdownResponderInstance extends ODBaseResponderInstance {
|
|
|
972
972
|
if (this.interaction.replied || this.interaction.deferred) {
|
|
973
973
|
const sent = await this.interaction.editReply(finalMessage);
|
|
974
974
|
this.ignoreResponderTimeout = true;
|
|
975
|
-
return { success: true, message:
|
|
975
|
+
return { success: true, message: sent, ephemeral: build.ephemeral };
|
|
976
976
|
}
|
|
977
977
|
else {
|
|
978
978
|
const sent = await this.interaction.update(finalMessage);
|
|
@@ -1313,7 +1313,7 @@ export class ODModalResponderInstance extends ODBaseResponderInstance {
|
|
|
1313
1313
|
if (this.interaction.replied || this.interaction.deferred) {
|
|
1314
1314
|
const sent = await this.interaction.editReply(finalMessage);
|
|
1315
1315
|
this.ignoreResponderTimeout = true;
|
|
1316
|
-
return { success: true, message:
|
|
1316
|
+
return { success: true, message: sent, ephemeral: build.ephemeral };
|
|
1317
1317
|
}
|
|
1318
1318
|
else {
|
|
1319
1319
|
const sent = await this.interaction.reply(finalMessage);
|
|
@@ -1333,7 +1333,7 @@ export class ODModalResponderInstance extends ODBaseResponderInstance {
|
|
|
1333
1333
|
if (this.interaction.replied || this.interaction.deferred) {
|
|
1334
1334
|
const sent = await this.interaction.editReply(finalMessage);
|
|
1335
1335
|
this.ignoreResponderTimeout = true;
|
|
1336
|
-
return { success: true, message:
|
|
1336
|
+
return { success: true, message: sent, ephemeral: build.ephemeral };
|
|
1337
1337
|
}
|
|
1338
1338
|
else {
|
|
1339
1339
|
const sent = await this.interaction.reply(finalMessage);
|
|
@@ -1505,7 +1505,7 @@ export class ODContextMenuResponderInstance extends ODBaseResponderInstance {
|
|
|
1505
1505
|
if (this.interaction.replied || this.interaction.deferred) {
|
|
1506
1506
|
const sent = await this.interaction.editReply(finalMessage);
|
|
1507
1507
|
this.ignoreResponderTimeout = true;
|
|
1508
|
-
return { success: true, message:
|
|
1508
|
+
return { success: true, message: sent, ephemeral: build.ephemeral };
|
|
1509
1509
|
}
|
|
1510
1510
|
else
|
|
1511
1511
|
throw new ODSystemError("Unable to update context menu interaction!");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-discord-bots/framework",
|
|
3
3
|
"author": "DJj123dj",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.3",
|
|
5
5
|
"description": "The core framework of the popular open-source discord bots: Open Ticket & Open Moderation.",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|