@open-discord-bots/framework 2.0.2 → 2.0.4

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.2"));
47
+ this.versions.add(ODVersion.fromString("opendiscord:api", "v2.0.4"));
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 component. */
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 component. */
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);
@@ -1663,7 +1663,7 @@ export class ODAutocompleteResponderInstance extends ODBaseResponderInstance {
1663
1663
  else
1664
1664
  return raw;
1665
1665
  });
1666
- const filteredChoices = newChoices.filter((choice) => choice.name.startsWith(this.target.value) || choice.value.toString().startsWith(this.target.value)).slice(0, 25);
1666
+ const filteredChoices = newChoices.filter((choice) => choice.name.toLowerCase().includes(this.target.value.toLowerCase()) || choice.value.toString().toLowerCase().includes(this.target.value.toLowerCase())).slice(0, 25);
1667
1667
  return await this.autocomplete(filteredChoices);
1668
1668
  }
1669
1669
  }
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.2",
4
+ "version": "2.0.4",
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",