@mostfeatured/dbi 0.0.53 → 0.0.55

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 (78) hide show
  1. package/dist/DBI.d.ts +156 -156
  2. package/dist/DBI.js +332 -332
  3. package/dist/Events.d.ts +53 -53
  4. package/dist/Events.js +58 -58
  5. package/dist/data/eventMap.json +234 -234
  6. package/dist/index.d.ts +6 -6
  7. package/dist/index.js +16 -16
  8. package/dist/methods/hookEventListeners.d.ts +3 -3
  9. package/dist/methods/hookEventListeners.js +87 -87
  10. package/dist/methods/hookInteractionListeners.d.ts +3 -3
  11. package/dist/methods/hookInteractionListeners.js +118 -118
  12. package/dist/methods/publishInteractions.d.ts +7 -7
  13. package/dist/methods/publishInteractions.js +238 -238
  14. package/dist/types/Button.d.ts +18 -16
  15. package/dist/types/Button.d.ts.map +1 -1
  16. package/dist/types/Button.js +31 -27
  17. package/dist/types/Button.js.map +1 -1
  18. package/dist/types/ButtonBuilder.d.ts +30 -0
  19. package/dist/types/ButtonBuilder.d.ts.map +1 -0
  20. package/dist/types/ButtonBuilder.js +43 -0
  21. package/dist/types/ButtonBuilder.js.map +1 -0
  22. package/dist/types/ChatInput/ChatInput.d.ts +15 -15
  23. package/dist/types/ChatInput/ChatInput.js +20 -20
  24. package/dist/types/ChatInput/ChatInputOptions.d.ts +162 -161
  25. package/dist/types/ChatInput/ChatInputOptions.d.ts.map +1 -1
  26. package/dist/types/ChatInput/ChatInputOptions.js +161 -160
  27. package/dist/types/ChatInput/ChatInputOptions.js.map +1 -1
  28. package/dist/types/CustomEvent.d.ts +13 -13
  29. package/dist/types/CustomEvent.js +19 -19
  30. package/dist/types/Event.d.ts +263 -263
  31. package/dist/types/Event.js +22 -22
  32. package/dist/types/Interaction.d.ts +47 -47
  33. package/dist/types/Interaction.js +24 -24
  34. package/dist/types/InteractionLocale.d.ts +25 -25
  35. package/dist/types/InteractionLocale.js +14 -14
  36. package/dist/types/Locale.d.ts +21 -21
  37. package/dist/types/Locale.js +38 -38
  38. package/dist/types/MessageContextMenu.d.ts +14 -14
  39. package/dist/types/MessageContextMenu.js +18 -18
  40. package/dist/types/Modal.d.ts +22 -20
  41. package/dist/types/Modal.d.ts.map +1 -1
  42. package/dist/types/Modal.js +29 -25
  43. package/dist/types/Modal.js.map +1 -1
  44. package/dist/types/ModalBuilder.d.ts +31 -0
  45. package/dist/types/ModalBuilder.d.ts.map +1 -0
  46. package/dist/types/ModalBuilder.js +43 -0
  47. package/dist/types/ModalBuilder.js.map +1 -0
  48. package/dist/types/SelectMenu.d.ts +18 -16
  49. package/dist/types/SelectMenu.d.ts.map +1 -1
  50. package/dist/types/SelectMenu.js +31 -27
  51. package/dist/types/SelectMenu.js.map +1 -1
  52. package/dist/types/SelectMenuBuilder.d.ts +28 -0
  53. package/dist/types/SelectMenuBuilder.d.ts.map +1 -0
  54. package/dist/types/SelectMenuBuilder.js +43 -0
  55. package/dist/types/SelectMenuBuilder.js.map +1 -0
  56. package/dist/types/UserContextMenu.d.ts +14 -14
  57. package/dist/types/UserContextMenu.js +18 -18
  58. package/dist/utils/MemoryStore.d.ts +8 -8
  59. package/dist/utils/MemoryStore.js +29 -29
  60. package/dist/utils/UtilTypes.d.ts +7 -7
  61. package/dist/utils/UtilTypes.d.ts.map +1 -1
  62. package/dist/utils/UtilTypes.js +2 -2
  63. package/dist/utils/UtilTypes.js.map +1 -1
  64. package/dist/utils/customId.d.ts +7 -7
  65. package/dist/utils/customId.js +45 -45
  66. package/dist/utils/permissions.d.ts +2 -2
  67. package/dist/utils/permissions.js +8 -8
  68. package/dist/utils/recursiveImport.d.ts +4 -4
  69. package/dist/utils/recursiveImport.js +26 -26
  70. package/package.json +2 -2
  71. package/src/types/Button.ts +7 -2
  72. package/src/types/ButtonBuilder.ts +52 -0
  73. package/src/types/ChatInput/ChatInputOptions.ts +1 -0
  74. package/src/types/Modal.ts +8 -2
  75. package/src/types/ModalBuilder.ts +52 -0
  76. package/src/types/SelectMenu.ts +8 -2
  77. package/src/types/SelectMenuBuilder.ts +52 -0
  78. package/src/utils/UtilTypes.ts +1 -1
package/dist/Events.d.ts CHANGED
@@ -1,54 +1,54 @@
1
- import { NamespaceEnums, NamespaceData } from "../generated/namespaceData";
2
- import { DBI } from "./DBI";
3
- import { ClientEvents } from "./types/Event";
4
- import { IDBIBaseExecuteCtx, TDBIRateLimitTypes } from "./types/Interaction";
5
- import { DBILocale } from "./types/Locale";
6
- export declare type TDBIEventNames = "beforeInteraction" | "afterInteraction" | "interactionRateLimit" | "beforeEvent" | "afterEvent" | "interactionError" | "eventError";
7
- export declare class Events<TNamespace extends NamespaceEnums> {
8
- DBI: DBI<TNamespace>;
9
- handlers: Record<string, Array<(data: any) => boolean | Promise<boolean>>>;
10
- constructor(DBI: DBI<TNamespace>);
11
- trigger(name: TDBIEventNames, data: any): Promise<boolean>;
12
- on(eventName: "beforeInteraction" | "afterInteraction", handler: (data: IDBIBaseExecuteCtx<TNamespace>) => Promise<boolean> | boolean, options?: {
13
- once: boolean;
14
- }): (() => any);
15
- on(eventName: "interactionError", handler: (data: IDBIBaseExecuteCtx<TNamespace> & {
16
- error: any;
17
- }) => Promise<boolean> | boolean, options?: {
18
- once: boolean;
19
- }): (() => any);
20
- on(eventName: "beforeEvent" | "afterEvent", handler: (data: {
21
- [K in keyof (ClientEvents & NamespaceData[TNamespace]["customEvents"])]: {
22
- other: Record<string, any>;
23
- locale?: {
24
- guild: DBILocale<TNamespace>;
25
- };
26
- eventName: K;
27
- } & (ClientEvents & NamespaceData[TNamespace]["customEvents"])[K];
28
- }[keyof (ClientEvents & NamespaceData[TNamespace]["customEvents"])]) => Promise<boolean> | boolean, options?: {
29
- once: boolean;
30
- }): (() => any);
31
- on(eventName: "eventError", handler: (data: {
32
- [K in keyof (ClientEvents & NamespaceData[TNamespace]["customEvents"])]: {
33
- other: Record<string, any>;
34
- locale?: {
35
- guild: DBILocale<TNamespace>;
36
- };
37
- eventName: K;
38
- error: any;
39
- } & (ClientEvents & NamespaceData[TNamespace]["customEvents"])[K];
40
- }[keyof (ClientEvents & NamespaceData[TNamespace]["customEvents"])]) => Promise<boolean> | boolean, options?: {
41
- once: boolean;
42
- }): (() => any);
43
- on(eventName: "interactionRateLimit", handler: (data: Omit<IDBIBaseExecuteCtx<TNamespace>, "other" | "setRateLimit"> & {
44
- rateLimit: {
45
- type: TDBIRateLimitTypes;
46
- duration: number;
47
- at: number;
48
- };
49
- }) => Promise<boolean> | boolean, options?: {
50
- once: boolean;
51
- }): (() => any);
52
- off(eventName: TDBIEventNames, handler: (data: any) => Promise<boolean> | boolean): ((data: any) => boolean | Promise<boolean>)[];
53
- }
1
+ import { NamespaceEnums, NamespaceData } from "../generated/namespaceData";
2
+ import { DBI } from "./DBI";
3
+ import { ClientEvents } from "./types/Event";
4
+ import { IDBIBaseExecuteCtx, TDBIRateLimitTypes } from "./types/Interaction";
5
+ import { DBILocale } from "./types/Locale";
6
+ export declare type TDBIEventNames = "beforeInteraction" | "afterInteraction" | "interactionRateLimit" | "beforeEvent" | "afterEvent" | "interactionError" | "eventError";
7
+ export declare class Events<TNamespace extends NamespaceEnums> {
8
+ DBI: DBI<TNamespace>;
9
+ handlers: Record<string, Array<(data: any) => boolean | Promise<boolean>>>;
10
+ constructor(DBI: DBI<TNamespace>);
11
+ trigger(name: TDBIEventNames, data: any): Promise<boolean>;
12
+ on(eventName: "beforeInteraction" | "afterInteraction", handler: (data: IDBIBaseExecuteCtx<TNamespace>) => Promise<boolean> | boolean, options?: {
13
+ once: boolean;
14
+ }): (() => any);
15
+ on(eventName: "interactionError", handler: (data: IDBIBaseExecuteCtx<TNamespace> & {
16
+ error: any;
17
+ }) => Promise<boolean> | boolean, options?: {
18
+ once: boolean;
19
+ }): (() => any);
20
+ on(eventName: "beforeEvent" | "afterEvent", handler: (data: {
21
+ [K in keyof (ClientEvents & NamespaceData[TNamespace]["customEvents"])]: {
22
+ other: Record<string, any>;
23
+ locale?: {
24
+ guild: DBILocale<TNamespace>;
25
+ };
26
+ eventName: K;
27
+ } & (ClientEvents & NamespaceData[TNamespace]["customEvents"])[K];
28
+ }[keyof (ClientEvents & NamespaceData[TNamespace]["customEvents"])]) => Promise<boolean> | boolean, options?: {
29
+ once: boolean;
30
+ }): (() => any);
31
+ on(eventName: "eventError", handler: (data: {
32
+ [K in keyof (ClientEvents & NamespaceData[TNamespace]["customEvents"])]: {
33
+ other: Record<string, any>;
34
+ locale?: {
35
+ guild: DBILocale<TNamespace>;
36
+ };
37
+ eventName: K;
38
+ error: any;
39
+ } & (ClientEvents & NamespaceData[TNamespace]["customEvents"])[K];
40
+ }[keyof (ClientEvents & NamespaceData[TNamespace]["customEvents"])]) => Promise<boolean> | boolean, options?: {
41
+ once: boolean;
42
+ }): (() => any);
43
+ on(eventName: "interactionRateLimit", handler: (data: Omit<IDBIBaseExecuteCtx<TNamespace>, "other" | "setRateLimit"> & {
44
+ rateLimit: {
45
+ type: TDBIRateLimitTypes;
46
+ duration: number;
47
+ at: number;
48
+ };
49
+ }) => Promise<boolean> | boolean, options?: {
50
+ once: boolean;
51
+ }): (() => any);
52
+ off(eventName: TDBIEventNames, handler: (data: any) => Promise<boolean> | boolean): ((data: any) => boolean | Promise<boolean>)[];
53
+ }
54
54
  //# sourceMappingURL=Events.d.ts.map
package/dist/Events.js CHANGED
@@ -1,59 +1,59 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Events = void 0;
4
- class Events {
5
- DBI;
6
- handlers;
7
- constructor(DBI) {
8
- this.DBI = DBI;
9
- this.handlers = {
10
- beforeInteraction: [],
11
- afterInteraction: [],
12
- interactionRateLimit: [],
13
- beforeEvent: [],
14
- afterEvent: [],
15
- interactionError: [],
16
- eventError: []
17
- };
18
- }
19
- async trigger(name, data) {
20
- let handlers = this.handlers[name];
21
- if (!handlers)
22
- return true;
23
- for (let i = 0; i < handlers.length; i++) {
24
- const handler = handlers[i];
25
- let returned = await handler(data);
26
- if (returned !== true)
27
- return false;
28
- }
29
- return true;
30
- }
31
- on(eventName, handler, options = { once: false }) {
32
- if (!this.handlers.hasOwnProperty(eventName))
33
- this.handlers[eventName] = [];
34
- if (options.once) {
35
- let h = (data) => {
36
- this.off(eventName, h);
37
- return handler(data);
38
- };
39
- this.on(eventName, h, { once: false });
40
- return () => {
41
- this.off(eventName, h);
42
- };
43
- }
44
- else {
45
- this.handlers[eventName].push(handler);
46
- return () => {
47
- this.off(eventName, handler);
48
- };
49
- }
50
- }
51
- off(eventName, handler) {
52
- let l = this.handlers[eventName];
53
- if (!l)
54
- return [];
55
- return l.splice(l.indexOf(handler), 1);
56
- }
57
- }
58
- exports.Events = Events;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Events = void 0;
4
+ class Events {
5
+ DBI;
6
+ handlers;
7
+ constructor(DBI) {
8
+ this.DBI = DBI;
9
+ this.handlers = {
10
+ beforeInteraction: [],
11
+ afterInteraction: [],
12
+ interactionRateLimit: [],
13
+ beforeEvent: [],
14
+ afterEvent: [],
15
+ interactionError: [],
16
+ eventError: []
17
+ };
18
+ }
19
+ async trigger(name, data) {
20
+ let handlers = this.handlers[name];
21
+ if (!handlers)
22
+ return true;
23
+ for (let i = 0; i < handlers.length; i++) {
24
+ const handler = handlers[i];
25
+ let returned = await handler(data);
26
+ if (returned !== true)
27
+ return false;
28
+ }
29
+ return true;
30
+ }
31
+ on(eventName, handler, options = { once: false }) {
32
+ if (!this.handlers.hasOwnProperty(eventName))
33
+ this.handlers[eventName] = [];
34
+ if (options.once) {
35
+ let h = (data) => {
36
+ this.off(eventName, h);
37
+ return handler(data);
38
+ };
39
+ this.on(eventName, h, { once: false });
40
+ return () => {
41
+ this.off(eventName, h);
42
+ };
43
+ }
44
+ else {
45
+ this.handlers[eventName].push(handler);
46
+ return () => {
47
+ this.off(eventName, handler);
48
+ };
49
+ }
50
+ }
51
+ off(eventName, handler) {
52
+ let l = this.handlers[eventName];
53
+ if (!l)
54
+ return [];
55
+ return l.splice(l.indexOf(handler), 1);
56
+ }
57
+ }
58
+ exports.Events = Events;
59
59
  //# sourceMappingURL=Events.js.map