@open-discord-bots/framework 2.0.3 → 2.0.5

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.3"));
47
+ this.versions.add(ODVersion.fromString("opendiscord:api", "v2.0.5"));
48
48
  this.versions.add(ODVersion.fromString("opendiscord:livestatus", "v2.0.0"));
49
49
  this.debugfile = managers.debugfile;
50
50
  this.console = managers.console;
@@ -221,6 +221,8 @@ export type ODCheckerFunctionManagerIdConstraint = Record<string, ODCheckerFunct
221
221
  */
222
222
  export declare class ODCheckerFunctionManager<IdList extends ODCheckerFunctionManagerIdConstraint = ODCheckerFunctionManagerIdConstraint> extends ODManager<ODCheckerFunction> {
223
223
  constructor(debug: ODDebugger);
224
+ /**Get a human-readable number string. */
225
+ protected ordinalNumber(num: number): string;
224
226
  /**A shortcut to create a warning, info or error message */
225
227
  createMessage(checkerId: ODValidId, id: ODValidId, filepath: string, type: "info" | "warning" | "error", message: string, locationTrace: ODCheckerLocationTrace, docs: string | null, translationParams: string[], locationId: ODId, locationDocs: string | null): ODCheckerMessage;
226
228
  /**Create a string from the location trace (path)*/
@@ -400,6 +400,21 @@ export class ODCheckerFunctionManager extends ODManager {
400
400
  constructor(debug) {
401
401
  super(debug, "config checker function");
402
402
  }
403
+ /**Get a human-readable number string. */
404
+ ordinalNumber(num) {
405
+ const i = Math.abs(Math.round(num));
406
+ const cent = i % 100;
407
+ if (cent >= 10 && cent <= 20)
408
+ return i + 'th';
409
+ const dec = i % 10;
410
+ if (dec === 1)
411
+ return i + 'st';
412
+ if (dec === 2)
413
+ return i + 'nd';
414
+ if (dec === 3)
415
+ return i + 'rd';
416
+ return i + 'th';
417
+ }
403
418
  /**A shortcut to create a warning, info or error message */
404
419
  createMessage(checkerId, id, filepath, type, message, locationTrace, docs, translationParams, locationId, locationDocs) {
405
420
  return {
@@ -419,7 +434,7 @@ export class ODCheckerFunctionManager extends ODManager {
419
434
  const final = [];
420
435
  trace.forEach((t) => {
421
436
  if (typeof t == "number") {
422
- final.push(`:${t}`);
437
+ final.push(`:(${this.ordinalNumber(t + 1)})`);
423
438
  }
424
439
  else {
425
440
  final.push(`."${t}"`);
@@ -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.3",
4
+ "version": "2.0.5",
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",