@mostfeatured/dbi 0.0.55 → 0.0.57

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 (65) 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.d.ts.map +1 -1
  12. package/dist/methods/hookInteractionListeners.js +125 -118
  13. package/dist/methods/hookInteractionListeners.js.map +1 -1
  14. package/dist/methods/publishInteractions.d.ts +7 -7
  15. package/dist/methods/publishInteractions.js +238 -238
  16. package/dist/types/Button.d.ts +18 -18
  17. package/dist/types/Button.js +31 -31
  18. package/dist/types/ButtonBuilder.d.ts +29 -29
  19. package/dist/types/ButtonBuilder.js +42 -42
  20. package/dist/types/ChatInput/ChatInput.d.ts +15 -15
  21. package/dist/types/ChatInput/ChatInput.js +20 -20
  22. package/dist/types/ChatInput/ChatInputOptions.d.ts +162 -162
  23. package/dist/types/ChatInput/ChatInputOptions.js +161 -161
  24. package/dist/types/CustomEvent.d.ts +13 -13
  25. package/dist/types/CustomEvent.js +19 -19
  26. package/dist/types/Event.d.ts +263 -263
  27. package/dist/types/Event.js +22 -22
  28. package/dist/types/Interaction.d.ts +47 -47
  29. package/dist/types/Interaction.js +24 -24
  30. package/dist/types/InteractionLocale.d.ts +25 -25
  31. package/dist/types/InteractionLocale.js +14 -14
  32. package/dist/types/Locale.d.ts +21 -21
  33. package/dist/types/Locale.js +38 -38
  34. package/dist/types/MessageContextMenu.d.ts +14 -14
  35. package/dist/types/MessageContextMenu.js +18 -18
  36. package/dist/types/Modal.d.ts +22 -22
  37. package/dist/types/Modal.js +29 -29
  38. package/dist/types/ModalBuilder.d.ts +30 -30
  39. package/dist/types/ModalBuilder.js +42 -42
  40. package/dist/types/SelectMenu.d.ts +18 -18
  41. package/dist/types/SelectMenu.d.ts.map +1 -1
  42. package/dist/types/SelectMenu.js +31 -31
  43. package/dist/types/SelectMenu.js.map +1 -1
  44. package/dist/types/SelectMenuBuilder.d.ts +27 -27
  45. package/dist/types/SelectMenuBuilder.d.ts.map +1 -1
  46. package/dist/types/SelectMenuBuilder.js +42 -42
  47. package/dist/types/SelectMenuBuilder.js.map +1 -1
  48. package/dist/types/UserContextMenu.d.ts +14 -14
  49. package/dist/types/UserContextMenu.js +18 -18
  50. package/dist/utils/MemoryStore.d.ts +8 -8
  51. package/dist/utils/MemoryStore.js +29 -29
  52. package/dist/utils/UtilTypes.d.ts +7 -7
  53. package/dist/utils/UtilTypes.js +2 -2
  54. package/dist/utils/customId.d.ts +7 -7
  55. package/dist/utils/customId.js +45 -45
  56. package/dist/utils/permissions.d.ts +2 -2
  57. package/dist/utils/permissions.js +8 -8
  58. package/dist/utils/recursiveImport.d.ts +4 -4
  59. package/dist/utils/recursiveImport.js +26 -26
  60. package/package.json +1 -1
  61. package/readme.md +5 -5
  62. package/src/methods/hookInteractionListeners.ts +7 -0
  63. package/src/types/SelectMenu.ts +2 -2
  64. package/src/types/SelectMenuBuilder.ts +3 -3
  65. package/test.js +0 -34
package/readme.md CHANGED
@@ -103,7 +103,7 @@ Remember, you can summon as many features as you want at the same time!
103
103
 
104
104
  `ChatInput` is defined as "Slash Command" as you can understand.
105
105
 
106
- <sub>`src/chatInput.js` dosyası:</sub>
106
+ <sub>`src/chatInput.js` file:</sub>
107
107
 
108
108
  ```js
109
109
  const dbi = require("../dbi");
@@ -150,7 +150,7 @@ You can also find more examples below for a sample demonstration of how the Loca
150
150
 
151
151
  # Event
152
152
 
153
- <sub>`src/event.js` dosyası:</sub>
153
+ <sub>`src/event.js` file:</sub>
154
154
 
155
155
  ```js
156
156
  const dbi = require("../dbi");
@@ -168,7 +168,7 @@ When defining an event, you can write the name of the event you want in the `nam
168
168
 
169
169
  # Locale
170
170
 
171
- <sub>`src/locales.js` dosyası:</sub>
171
+ <sub>`src/locales.js` file:</sub>
172
172
 
173
173
  ```js
174
174
  const dbi = require("../dbi");
@@ -204,7 +204,7 @@ Thanks to Locale, there is information in each interaction that will make it eas
204
204
 
205
205
  In this section, we will look at three of our features. (Actually, it's all the same feature in the background.)
206
206
 
207
- <sub>`src/components.js` dosyası:</sub>
207
+ <sub>`src/components.js` file:</sub>
208
208
 
209
209
  ```js
210
210
  const dbi = require("../dbi");
@@ -233,7 +233,7 @@ It has exactly the same properties as `ChatInput` but does not take `options` va
233
233
  We offer you another unique feature. You can now define a custom script language for each user.
234
234
  For example, the command that appears as `/select gender` to a Turkish user may appear as `/select gender` to a foreign user. (You can configure it as you wish.)
235
235
 
236
- <sub>`src/interactionlocales.js` dosyası:</sub>
236
+ <sub>`src/interactionlocales.js` file:</sub>
237
237
 
238
238
  ```js
239
239
  const dbi = require("../dbi");
@@ -106,6 +106,7 @@ export function hookInteractionListeners(dbi: DBI<NamespaceEnums>): () => any {
106
106
  }
107
107
 
108
108
  let arg = {
109
+ // @ts-ignore
109
110
  dbi,
110
111
  // @ts-ignore
111
112
  interaction: inter as any,
@@ -113,22 +114,28 @@ export function hookInteractionListeners(dbi: DBI<NamespaceEnums>): () => any {
113
114
  dbiInteraction: dbiInter,
114
115
  // @ts-ignore
115
116
  locale,
117
+ // @ts-ignore
116
118
  setRateLimit,
117
119
  // @ts-ignore
118
120
  data,
121
+ // @ts-ignore
119
122
  other
120
123
  };
121
124
 
122
125
  if (dbi.config.strict) {
126
+ // @ts-ignore
123
127
  await dbiInter.onExecute(arg);
124
128
  } else {
125
129
  try {
130
+ // @ts-ignore
126
131
  await dbiInter.onExecute(arg);
127
132
  } catch (error) {
133
+ // @ts-ignore
128
134
  await dbi.events.trigger("interactionError", Object.assign(arg, { error }));
129
135
  }
130
136
  }
131
137
 
138
+ // @ts-ignore
132
139
  dbi.events.trigger("afterInteraction", { dbi, interaction: inter, dbiInteraction: dbiInter, locale, setRateLimit, data, other });
133
140
  }
134
141
 
@@ -23,11 +23,11 @@ export class DBISelectMenu<TNamespace extends NamespaceEnums> extends DBIBaseInt
23
23
  });
24
24
  }
25
25
 
26
- declare options: Omit<Discord.SelectMenuComponentData, "customId" | "type">;
26
+ declare options: Omit<Discord.BaseSelectMenuComponentData, "customId" | "type">;
27
27
 
28
28
  override onExecute(ctx: IDBISelectMenuExecuteCtx<TNamespace>): Promise<void> | void { };
29
29
 
30
- toJSON(arg: IDBIToJSONArgs<DBISelectMenuOverrides> = {}): Discord.SelectMenuComponentData {
30
+ toJSON(arg: IDBIToJSONArgs<DBISelectMenuOverrides> = {}): Discord.BaseSelectMenuComponentData {
31
31
  return {
32
32
  ...stuffs.defaultify((arg?.overrides || {}), this.options || {}, true),
33
33
  customId: customIdBuilder(this.dbi as any, this.name, arg?.reference?.data || [], arg?.reference?.ttl),
@@ -1,9 +1,9 @@
1
- import { SelectMenuComponentData } from "discord.js";
1
+ import { BaseSelectMenuComponentData } from "discord.js";
2
2
  import { defaultify } from "stuffs";
3
3
  import { NamespaceEnums } from "../../generated/namespaceData";
4
4
  import { DBISelectMenu } from "./SelectMenu";
5
5
 
6
- export type DBISelectMenuOverrides = Omit<SelectMenuComponentData, "customId" | "type">
6
+ export type DBISelectMenuOverrides = Omit<BaseSelectMenuComponentData, "customId" | "type">
7
7
 
8
8
  export class DBISelectMenuBuilder<TNamespace extends NamespaceEnums> {
9
9
  component: DBISelectMenu<TNamespace>
@@ -45,7 +45,7 @@ export class DBISelectMenuBuilder<TNamespace extends NamespaceEnums> {
45
45
  return this;
46
46
  }
47
47
 
48
- toJSON(): SelectMenuComponentData {
48
+ toJSON(): BaseSelectMenuComponentData {
49
49
  return this.component.toJSON({ overrides: this.overrides, reference: this.reference });
50
50
  }
51
51
 
package/test.js DELETED
@@ -1,34 +0,0 @@
1
- const { createDBI } = require("./dist");
2
-
3
- const dbi = createDBI("test", {
4
- discord: { options: { intents: [] }, token: "" },
5
- });
6
-
7
- dbi.emit("momCreate", { mom: { test: "zort" } });
8
-
9
- dbi.register(({ Event, CustomEvent }) => {
10
-
11
- CustomEvent({
12
- name: "momCreate",
13
- map: {
14
- mom: "import('discord.js').GuildMember"
15
- },
16
- })
17
-
18
- Event({
19
- name: "momCreate",
20
- onExecute({mom}) {
21
-
22
- mom.ban({reason: "Aneni banladım"})
23
-
24
- }
25
- })
26
- });
27
- dbi.data.eventMap
28
- dbi.events.on("eventError", (data) => {
29
-
30
- if (data.eventName == "momCreate") {
31
- data.mom
32
- }
33
-
34
- })