@mostfeatured/dbi 0.0.54 → 0.0.56

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 (62) 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 -18
  15. package/dist/types/Button.js +31 -31
  16. package/dist/types/ButtonBuilder.d.ts +29 -29
  17. package/dist/types/ButtonBuilder.js +42 -42
  18. package/dist/types/ChatInput/ChatInput.d.ts +15 -15
  19. package/dist/types/ChatInput/ChatInput.js +20 -20
  20. package/dist/types/ChatInput/ChatInputOptions.d.ts +162 -162
  21. package/dist/types/ChatInput/ChatInputOptions.js +161 -161
  22. package/dist/types/CustomEvent.d.ts +13 -13
  23. package/dist/types/CustomEvent.js +19 -19
  24. package/dist/types/Event.d.ts +263 -263
  25. package/dist/types/Event.js +22 -22
  26. package/dist/types/Interaction.d.ts +47 -47
  27. package/dist/types/Interaction.js +24 -24
  28. package/dist/types/InteractionLocale.d.ts +25 -25
  29. package/dist/types/InteractionLocale.js +14 -14
  30. package/dist/types/Locale.d.ts +21 -21
  31. package/dist/types/Locale.js +38 -38
  32. package/dist/types/MessageContextMenu.d.ts +14 -14
  33. package/dist/types/MessageContextMenu.js +18 -18
  34. package/dist/types/Modal.d.ts +22 -22
  35. package/dist/types/Modal.js +29 -29
  36. package/dist/types/ModalBuilder.d.ts +30 -30
  37. package/dist/types/ModalBuilder.js +42 -42
  38. package/dist/types/SelectMenu.d.ts +18 -18
  39. package/dist/types/SelectMenu.d.ts.map +1 -1
  40. package/dist/types/SelectMenu.js +31 -31
  41. package/dist/types/SelectMenu.js.map +1 -1
  42. package/dist/types/SelectMenuBuilder.d.ts +27 -27
  43. package/dist/types/SelectMenuBuilder.d.ts.map +1 -1
  44. package/dist/types/SelectMenuBuilder.js +42 -42
  45. package/dist/types/SelectMenuBuilder.js.map +1 -1
  46. package/dist/types/UserContextMenu.d.ts +14 -14
  47. package/dist/types/UserContextMenu.js +18 -18
  48. package/dist/utils/MemoryStore.d.ts +8 -8
  49. package/dist/utils/MemoryStore.js +29 -29
  50. package/dist/utils/UtilTypes.d.ts +7 -7
  51. package/dist/utils/UtilTypes.js +2 -2
  52. package/dist/utils/customId.d.ts +7 -7
  53. package/dist/utils/customId.js +45 -45
  54. package/dist/utils/permissions.d.ts +2 -2
  55. package/dist/utils/permissions.js +8 -8
  56. package/dist/utils/recursiveImport.d.ts +4 -4
  57. package/dist/utils/recursiveImport.js +26 -26
  58. package/package.json +2 -2
  59. package/readme.md +5 -5
  60. package/src/types/SelectMenu.ts +2 -2
  61. package/src/types/SelectMenuBuilder.ts +3 -3
  62. package/test.js +0 -34
package/dist/DBI.d.ts CHANGED
@@ -1,157 +1,157 @@
1
- import Discord from "discord.js";
2
- import { DBIChatInput, TDBIChatInputOmitted } from "./types/ChatInput/ChatInput";
3
- import { DBIChatInputOptions } from "./types/ChatInput/ChatInputOptions";
4
- import { ClientEvents, DBIEvent, TDBIEventOmitted } from "./types/Event";
5
- import { Events } from "./Events";
6
- import { DBILocale, TDBILocaleConstructor, TDBILocaleString } from "./types/Locale";
7
- import { DBIButton, TDBIButtonOmitted } from "./types/Button";
8
- import { DBISelectMenu, TDBISelectMenuOmitted } from "./types/SelectMenu";
9
- import { DBIMessageContextMenu, TDBIMessageContextMenuOmitted } from "./types/MessageContextMenu";
10
- import { DBIUserContextMenu, TDBIUserContextMenuOmitted } from "./types/UserContextMenu";
11
- import { DBIModal, TDBIModalOmitted } from "./types/Modal";
12
- import * as Sharding from "discord-hybrid-sharding";
13
- import { DBIInteractionLocale, TDBIInteractionLocaleOmitted } from "./types/InteractionLocale";
14
- import { TDBIInteractions } from "./types/Interaction";
15
- import { NamespaceData, NamespaceEnums } from "../generated/namespaceData";
16
- import { DBICustomEvent, TDBICustomEventOmitted } from "./types/CustomEvent";
17
- export interface DBIStore {
18
- get(key: string, defaultValue?: any): Promise<any>;
19
- set(key: string, value: any): Promise<void>;
20
- delete(key: string): Promise<void>;
21
- has(key: string): Promise<boolean>;
22
- }
23
- export interface DBIConfig {
24
- discord: {
25
- token: string;
26
- options: Discord.ClientOptions;
27
- };
28
- defaults: {
29
- locale: TDBILocaleString;
30
- directMessages: boolean;
31
- defaultMemberPermissions: Discord.PermissionsString[];
32
- };
33
- sharding: "hybrid" | "default" | "off";
34
- /**
35
- * Persist store. (Default to MemoryStore thats not persis tho.)
36
- */
37
- store: DBIStore;
38
- references: {
39
- autoClear?: {
40
- check: number;
41
- ttl: number;
42
- };
43
- };
44
- strict: boolean;
45
- }
46
- export interface DBIConfigConstructor {
47
- discord: {
48
- token: string;
49
- options: Discord.ClientOptions;
50
- };
51
- defaults?: {
52
- locale?: TDBILocaleString;
53
- directMessages?: boolean;
54
- defaultMemberPermissions?: Discord.PermissionsString[];
55
- };
56
- sharding?: "hybrid" | "default" | "off";
57
- /**
58
- * Persist store. (Default to MemoryStore thats not persis tho.)
59
- */
60
- store?: DBIStore;
61
- references?: {
62
- autoClear?: {
63
- check: number;
64
- ttl: number;
65
- };
66
- };
67
- strict?: boolean;
68
- }
69
- export interface DBIRegisterAPI<TNamespace extends NamespaceEnums> {
70
- ChatInput(cfg: TDBIChatInputOmitted<TNamespace>): DBIChatInput<TNamespace>;
71
- ChatInputOptions: DBIChatInputOptions<TNamespace>;
72
- Event(cfg: TDBIEventOmitted<TNamespace>): DBIEvent<TNamespace>;
73
- Locale(cfg: TDBILocaleConstructor<TNamespace>): DBILocale<TNamespace>;
74
- Button(cfg: TDBIButtonOmitted<TNamespace>): DBIButton<TNamespace>;
75
- SelectMenu(cfg: TDBISelectMenuOmitted<TNamespace>): DBISelectMenu<TNamespace>;
76
- MessageContextMenu(cfg: TDBIMessageContextMenuOmitted<TNamespace>): DBIMessageContextMenu<TNamespace>;
77
- UserContextMenu(cfg: TDBIUserContextMenuOmitted<TNamespace>): DBIUserContextMenu<TNamespace>;
78
- InteractionLocale(cfg: TDBIInteractionLocaleOmitted): DBIInteractionLocale;
79
- Modal(cfg: TDBIModalOmitted<TNamespace>): DBIModal<TNamespace>;
80
- CustomEvent<T extends keyof NamespaceData[TNamespace]["customEvents"]>(cfg: TDBICustomEventOmitted<TNamespace, T>): DBICustomEvent<TNamespace, T>;
81
- onUnload(cb: () => Promise<any> | any): any;
82
- }
83
- export declare class DBI<TNamespace extends NamespaceEnums, TOtherData = Record<string, any>> {
84
- namespace: TNamespace;
85
- config: DBIConfig;
86
- client: Discord.Client<true>;
87
- data: {
88
- interactions: Discord.Collection<string, TDBIInteractions<TNamespace>>;
89
- events: Discord.Collection<string, DBIEvent<TNamespace>>;
90
- locales: Discord.Collection<string, DBILocale<TNamespace>>;
91
- interactionLocales: Discord.Collection<string, DBIInteractionLocale>;
92
- other: TOtherData;
93
- eventMap: Record<string, string[] | {
94
- [k: string]: string;
95
- }>;
96
- customEventNames: Set<string>;
97
- unloaders: Set<() => void>;
98
- registers: Set<(...args: any[]) => any>;
99
- registerUnloaders: Set<(...args: any[]) => any>;
100
- refs: Map<string, {
101
- at: number;
102
- value: any;
103
- ttl?: number;
104
- }>;
105
- };
106
- events: Events<TNamespace>;
107
- cluster?: Sharding.Client;
108
- private _loaded;
109
- private _hooked;
110
- constructor(namespace: TNamespace, config: DBIConfigConstructor);
111
- private _hookListeners;
112
- private _unhookListeners;
113
- private _unregisterAll;
114
- private _registerAll;
115
- /**
116
- * this.data.interactions.get(name)
117
- */
118
- interaction<TInteractionName extends keyof NamespaceData[TNamespace]["interactionMapping"]>(name: TInteractionName): NamespaceData[TNamespace]["interactionMapping"][TInteractionName];
119
- emit<TEventName extends keyof (NamespaceData[TNamespace]["customEvents"] & ClientEvents)>(name: TEventName, args: (NamespaceData[TNamespace]["customEvents"] & ClientEvents)[TEventName]): void;
120
- /**
121
- *
122
- * ((NamespaceData[TNamespace]["customEvents"] & ClientEvents)[K] as const)
123
- * typeof ((NamespaceData[TNamespace]["customEvents"] & ClientEvents)[K])[keyof typeof ((NamespaceData[TNamespace]["customEvents"] & ClientEvents)[K])]
124
- */
125
- /**
126
- * this.data.events.get(name)
127
- */
128
- event<TEventName extends NamespaceData[TNamespace]["eventNames"]>(name: TEventName): DBIEvent<TNamespace>;
129
- /**
130
- * this.data.locales.get(name)
131
- */
132
- locale<TLocaleName extends NamespaceData[TNamespace]["localeNames"]>(name: TLocaleName): DBILocale<TNamespace>;
133
- /**
134
- * Shorthands for modifying `dbi.data.other`
135
- */
136
- get<K extends keyof TOtherData>(k: K, defaultValue?: TOtherData[K]): TOtherData[K];
137
- /**
138
- * Shorthands for modifying `dbi.data.other`
139
- */
140
- set<K extends keyof TOtherData>(k: K, v: TOtherData[K]): any;
141
- /**
142
- * Shorthands for modifying `dbi.data.other`
143
- */
144
- has(k: string): boolean;
145
- /**
146
- * Shorthands for modifying `dbi.data.other`
147
- */
148
- delete(k: string): boolean;
149
- login(): Promise<any>;
150
- register(cb: (api: DBIRegisterAPI<TNamespace>) => void): Promise<any>;
151
- load(): Promise<boolean>;
152
- unload(): Promise<boolean>;
153
- get loaded(): boolean;
154
- publish(type: "Global", clear?: boolean): Promise<any>;
155
- publish(type: "Guild", guildId: string, clear?: boolean): Promise<any>;
156
- }
1
+ import Discord from "discord.js";
2
+ import { DBIChatInput, TDBIChatInputOmitted } from "./types/ChatInput/ChatInput";
3
+ import { DBIChatInputOptions } from "./types/ChatInput/ChatInputOptions";
4
+ import { ClientEvents, DBIEvent, TDBIEventOmitted } from "./types/Event";
5
+ import { Events } from "./Events";
6
+ import { DBILocale, TDBILocaleConstructor, TDBILocaleString } from "./types/Locale";
7
+ import { DBIButton, TDBIButtonOmitted } from "./types/Button";
8
+ import { DBISelectMenu, TDBISelectMenuOmitted } from "./types/SelectMenu";
9
+ import { DBIMessageContextMenu, TDBIMessageContextMenuOmitted } from "./types/MessageContextMenu";
10
+ import { DBIUserContextMenu, TDBIUserContextMenuOmitted } from "./types/UserContextMenu";
11
+ import { DBIModal, TDBIModalOmitted } from "./types/Modal";
12
+ import * as Sharding from "discord-hybrid-sharding";
13
+ import { DBIInteractionLocale, TDBIInteractionLocaleOmitted } from "./types/InteractionLocale";
14
+ import { TDBIInteractions } from "./types/Interaction";
15
+ import { NamespaceData, NamespaceEnums } from "../generated/namespaceData";
16
+ import { DBICustomEvent, TDBICustomEventOmitted } from "./types/CustomEvent";
17
+ export interface DBIStore {
18
+ get(key: string, defaultValue?: any): Promise<any>;
19
+ set(key: string, value: any): Promise<void>;
20
+ delete(key: string): Promise<void>;
21
+ has(key: string): Promise<boolean>;
22
+ }
23
+ export interface DBIConfig {
24
+ discord: {
25
+ token: string;
26
+ options: Discord.ClientOptions;
27
+ };
28
+ defaults: {
29
+ locale: TDBILocaleString;
30
+ directMessages: boolean;
31
+ defaultMemberPermissions: Discord.PermissionsString[];
32
+ };
33
+ sharding: "hybrid" | "default" | "off";
34
+ /**
35
+ * Persist store. (Default to MemoryStore thats not persis tho.)
36
+ */
37
+ store: DBIStore;
38
+ references: {
39
+ autoClear?: {
40
+ check: number;
41
+ ttl: number;
42
+ };
43
+ };
44
+ strict: boolean;
45
+ }
46
+ export interface DBIConfigConstructor {
47
+ discord: {
48
+ token: string;
49
+ options: Discord.ClientOptions;
50
+ };
51
+ defaults?: {
52
+ locale?: TDBILocaleString;
53
+ directMessages?: boolean;
54
+ defaultMemberPermissions?: Discord.PermissionsString[];
55
+ };
56
+ sharding?: "hybrid" | "default" | "off";
57
+ /**
58
+ * Persist store. (Default to MemoryStore thats not persis tho.)
59
+ */
60
+ store?: DBIStore;
61
+ references?: {
62
+ autoClear?: {
63
+ check: number;
64
+ ttl: number;
65
+ };
66
+ };
67
+ strict?: boolean;
68
+ }
69
+ export interface DBIRegisterAPI<TNamespace extends NamespaceEnums> {
70
+ ChatInput(cfg: TDBIChatInputOmitted<TNamespace>): DBIChatInput<TNamespace>;
71
+ ChatInputOptions: DBIChatInputOptions<TNamespace>;
72
+ Event(cfg: TDBIEventOmitted<TNamespace>): DBIEvent<TNamespace>;
73
+ Locale(cfg: TDBILocaleConstructor<TNamespace>): DBILocale<TNamespace>;
74
+ Button(cfg: TDBIButtonOmitted<TNamespace>): DBIButton<TNamespace>;
75
+ SelectMenu(cfg: TDBISelectMenuOmitted<TNamespace>): DBISelectMenu<TNamespace>;
76
+ MessageContextMenu(cfg: TDBIMessageContextMenuOmitted<TNamespace>): DBIMessageContextMenu<TNamespace>;
77
+ UserContextMenu(cfg: TDBIUserContextMenuOmitted<TNamespace>): DBIUserContextMenu<TNamespace>;
78
+ InteractionLocale(cfg: TDBIInteractionLocaleOmitted): DBIInteractionLocale;
79
+ Modal(cfg: TDBIModalOmitted<TNamespace>): DBIModal<TNamespace>;
80
+ CustomEvent<T extends keyof NamespaceData[TNamespace]["customEvents"]>(cfg: TDBICustomEventOmitted<TNamespace, T>): DBICustomEvent<TNamespace, T>;
81
+ onUnload(cb: () => Promise<any> | any): any;
82
+ }
83
+ export declare class DBI<TNamespace extends NamespaceEnums, TOtherData = Record<string, any>> {
84
+ namespace: TNamespace;
85
+ config: DBIConfig;
86
+ client: Discord.Client<true>;
87
+ data: {
88
+ interactions: Discord.Collection<string, TDBIInteractions<TNamespace>>;
89
+ events: Discord.Collection<string, DBIEvent<TNamespace>>;
90
+ locales: Discord.Collection<string, DBILocale<TNamespace>>;
91
+ interactionLocales: Discord.Collection<string, DBIInteractionLocale>;
92
+ other: TOtherData;
93
+ eventMap: Record<string, string[] | {
94
+ [k: string]: string;
95
+ }>;
96
+ customEventNames: Set<string>;
97
+ unloaders: Set<() => void>;
98
+ registers: Set<(...args: any[]) => any>;
99
+ registerUnloaders: Set<(...args: any[]) => any>;
100
+ refs: Map<string, {
101
+ at: number;
102
+ value: any;
103
+ ttl?: number;
104
+ }>;
105
+ };
106
+ events: Events<TNamespace>;
107
+ cluster?: Sharding.Client;
108
+ private _loaded;
109
+ private _hooked;
110
+ constructor(namespace: TNamespace, config: DBIConfigConstructor);
111
+ private _hookListeners;
112
+ private _unhookListeners;
113
+ private _unregisterAll;
114
+ private _registerAll;
115
+ /**
116
+ * this.data.interactions.get(name)
117
+ */
118
+ interaction<TInteractionName extends keyof NamespaceData[TNamespace]["interactionMapping"]>(name: TInteractionName): NamespaceData[TNamespace]["interactionMapping"][TInteractionName];
119
+ emit<TEventName extends keyof (NamespaceData[TNamespace]["customEvents"] & ClientEvents)>(name: TEventName, args: (NamespaceData[TNamespace]["customEvents"] & ClientEvents)[TEventName]): void;
120
+ /**
121
+ *
122
+ * ((NamespaceData[TNamespace]["customEvents"] & ClientEvents)[K] as const)
123
+ * typeof ((NamespaceData[TNamespace]["customEvents"] & ClientEvents)[K])[keyof typeof ((NamespaceData[TNamespace]["customEvents"] & ClientEvents)[K])]
124
+ */
125
+ /**
126
+ * this.data.events.get(name)
127
+ */
128
+ event<TEventName extends NamespaceData[TNamespace]["eventNames"]>(name: TEventName): DBIEvent<TNamespace>;
129
+ /**
130
+ * this.data.locales.get(name)
131
+ */
132
+ locale<TLocaleName extends NamespaceData[TNamespace]["localeNames"]>(name: TLocaleName): DBILocale<TNamespace>;
133
+ /**
134
+ * Shorthands for modifying `dbi.data.other`
135
+ */
136
+ get<K extends keyof TOtherData>(k: K, defaultValue?: TOtherData[K]): TOtherData[K];
137
+ /**
138
+ * Shorthands for modifying `dbi.data.other`
139
+ */
140
+ set<K extends keyof TOtherData>(k: K, v: TOtherData[K]): any;
141
+ /**
142
+ * Shorthands for modifying `dbi.data.other`
143
+ */
144
+ has(k: string): boolean;
145
+ /**
146
+ * Shorthands for modifying `dbi.data.other`
147
+ */
148
+ delete(k: string): boolean;
149
+ login(): Promise<any>;
150
+ register(cb: (api: DBIRegisterAPI<TNamespace>) => void): Promise<any>;
151
+ load(): Promise<boolean>;
152
+ unload(): Promise<boolean>;
153
+ get loaded(): boolean;
154
+ publish(type: "Global", clear?: boolean): Promise<any>;
155
+ publish(type: "Guild", guildId: string, clear?: boolean): Promise<any>;
156
+ }
157
157
  //# sourceMappingURL=DBI.d.ts.map