oopscord.js 0.0.24 → 0.0.26

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.
Files changed (31) hide show
  1. package/dist/structures/Constants.d.ts +2 -0
  2. package/dist/structures/Constants.d.ts.map +1 -1
  3. package/dist/structures/Constants.js +1 -0
  4. package/dist/structures/DiscordApp.d.ts +79 -2
  5. package/dist/structures/DiscordApp.d.ts.map +1 -1
  6. package/dist/structures/DiscordApp.js +215 -56
  7. package/dist/structures/components/BaseButton.d.ts +35 -1
  8. package/dist/structures/components/BaseButton.d.ts.map +1 -1
  9. package/dist/structures/components/BaseButton.js +70 -24
  10. package/dist/structures/components/BaseModal.d.ts +75 -6
  11. package/dist/structures/components/BaseModal.d.ts.map +1 -1
  12. package/dist/structures/components/BaseModal.js +133 -17
  13. package/dist/structures/components/BaseModal.test.d.ts +2 -0
  14. package/dist/structures/components/BaseModal.test.d.ts.map +1 -0
  15. package/dist/structures/components/BaseModal.test.js +109 -0
  16. package/dist/structures/components/BaseSelectMenu.d.ts +74 -4
  17. package/dist/structures/components/BaseSelectMenu.d.ts.map +1 -1
  18. package/dist/structures/components/BaseSelectMenu.js +117 -46
  19. package/dist/structures/decorators/Constants.d.ts +4 -1
  20. package/dist/structures/decorators/Constants.d.ts.map +1 -1
  21. package/dist/structures/decorators/Constants.js +5 -2
  22. package/dist/structures/decorators/DiscordModuleDecorator.d.ts +27 -0
  23. package/dist/structures/decorators/DiscordModuleDecorator.d.ts.map +1 -1
  24. package/dist/structures/decorators/DiscordModuleDecorator.js +27 -0
  25. package/dist/structures/decorators/MessageComponentDecorator.d.ts +72 -6
  26. package/dist/structures/decorators/MessageComponentDecorator.d.ts.map +1 -1
  27. package/dist/structures/decorators/MessageComponentDecorator.js +141 -20
  28. package/dist/utils/Util.d.ts +3 -0
  29. package/dist/utils/Util.d.ts.map +1 -1
  30. package/dist/utils/Util.js +15 -2
  31. package/package.json +4 -3
@@ -1,5 +1,8 @@
1
1
  import { InteractionButtonOptions, LinkButtonOptions } from "../structures/decorators/MessageComponentDecorator";
2
2
  export declare class Util {
3
3
  static isInteractionButtonOptions(options: InteractionButtonOptions | LinkButtonOptions): options is InteractionButtonOptions;
4
+ static mergeDefault<T extends {
5
+ [key: PropertyKey]: any;
6
+ }>(def: T, given: Partial<T>): T;
4
7
  }
5
8
  //# sourceMappingURL=Util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Util.d.ts","sourceRoot":"","sources":["../../src/utils/Util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AAEjH,qBAAa,IAAI;IACb,MAAM,CAAC,0BAA0B,CAAC,OAAO,EAAE,wBAAwB,GAAG,iBAAiB,GAAG,OAAO,IAAI,wBAAwB;CAGhI"}
1
+ {"version":3,"file":"Util.d.ts","sourceRoot":"","sources":["../../src/utils/Util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AAEjH,qBAAa,IAAI;IACb,MAAM,CAAC,0BAA0B,CAAC,OAAO,EAAE,wBAAwB,GAAG,iBAAiB,GAAG,OAAO,IAAI,wBAAwB;IAI7H,MAAM,CAAC,YAAY,CAAC,CAAC,SAAS;QAAE,CAAC,GAAG,EAAE,WAAW,GAAG,GAAG,CAAA;KAAE,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;CAa3F"}
@@ -1,10 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Util = void 0;
4
- const discord_js_1 = require("discord.js");
4
+ const v10_1 = require("discord-api-types/v10");
5
5
  class Util {
6
6
  static isInteractionButtonOptions(options) {
7
- return options.style != discord_js_1.ButtonStyle.Link;
7
+ return options.style != v10_1.ButtonStyle.Link;
8
+ }
9
+ static mergeDefault(def, given) {
10
+ if (!given)
11
+ return def;
12
+ for (const key in def) {
13
+ if (!Object.hasOwn(given, key) || given[key] === undefined) {
14
+ given[key] = def[key];
15
+ }
16
+ else if (given[key] === Object(given[key])) {
17
+ given[key] = this.mergeDefault(def[key], given[key]);
18
+ }
19
+ }
20
+ return given;
8
21
  }
9
22
  }
10
23
  exports.Util = Util;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oopscord.js",
3
- "version": "0.0.24",
3
+ "version": "0.0.26",
4
4
  "description": "An easy way to make discord apps in typescript.",
5
5
  "main": "dist",
6
6
  "scripts": {
@@ -29,9 +29,10 @@
29
29
  "reflect-metadata": "^0.1.14"
30
30
  },
31
31
  "devDependencies": {
32
- "@types/node": "^20.10.4",
33
- "discord.js": "^14.20.0",
32
+ "@types/node": "^20.19.35",
33
+ "discord.js": "^14.25.1",
34
34
  "typescript": "^5.8.3",
35
+ "vitest": "^4.0.18",
35
36
  "yarn": "^1.22.21"
36
37
  }
37
38
  }