@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.
- package/dist/DBI.d.ts +156 -156
- package/dist/DBI.js +332 -332
- package/dist/Events.d.ts +53 -53
- package/dist/Events.js +58 -58
- package/dist/data/eventMap.json +234 -234
- package/dist/index.d.ts +6 -6
- package/dist/index.js +16 -16
- package/dist/methods/hookEventListeners.d.ts +3 -3
- package/dist/methods/hookEventListeners.js +87 -87
- package/dist/methods/hookInteractionListeners.d.ts +3 -3
- package/dist/methods/hookInteractionListeners.d.ts.map +1 -1
- package/dist/methods/hookInteractionListeners.js +125 -118
- package/dist/methods/hookInteractionListeners.js.map +1 -1
- package/dist/methods/publishInteractions.d.ts +7 -7
- package/dist/methods/publishInteractions.js +238 -238
- package/dist/types/Button.d.ts +18 -18
- package/dist/types/Button.js +31 -31
- package/dist/types/ButtonBuilder.d.ts +29 -29
- package/dist/types/ButtonBuilder.js +42 -42
- package/dist/types/ChatInput/ChatInput.d.ts +15 -15
- package/dist/types/ChatInput/ChatInput.js +20 -20
- package/dist/types/ChatInput/ChatInputOptions.d.ts +162 -162
- package/dist/types/ChatInput/ChatInputOptions.js +161 -161
- package/dist/types/CustomEvent.d.ts +13 -13
- package/dist/types/CustomEvent.js +19 -19
- package/dist/types/Event.d.ts +263 -263
- package/dist/types/Event.js +22 -22
- package/dist/types/Interaction.d.ts +47 -47
- package/dist/types/Interaction.js +24 -24
- package/dist/types/InteractionLocale.d.ts +25 -25
- package/dist/types/InteractionLocale.js +14 -14
- package/dist/types/Locale.d.ts +21 -21
- package/dist/types/Locale.js +38 -38
- package/dist/types/MessageContextMenu.d.ts +14 -14
- package/dist/types/MessageContextMenu.js +18 -18
- package/dist/types/Modal.d.ts +22 -22
- package/dist/types/Modal.js +29 -29
- package/dist/types/ModalBuilder.d.ts +30 -30
- package/dist/types/ModalBuilder.js +42 -42
- package/dist/types/SelectMenu.d.ts +18 -18
- package/dist/types/SelectMenu.d.ts.map +1 -1
- package/dist/types/SelectMenu.js +31 -31
- package/dist/types/SelectMenu.js.map +1 -1
- package/dist/types/SelectMenuBuilder.d.ts +27 -27
- package/dist/types/SelectMenuBuilder.d.ts.map +1 -1
- package/dist/types/SelectMenuBuilder.js +42 -42
- package/dist/types/SelectMenuBuilder.js.map +1 -1
- package/dist/types/UserContextMenu.d.ts +14 -14
- package/dist/types/UserContextMenu.js +18 -18
- package/dist/utils/MemoryStore.d.ts +8 -8
- package/dist/utils/MemoryStore.js +29 -29
- package/dist/utils/UtilTypes.d.ts +7 -7
- package/dist/utils/UtilTypes.js +2 -2
- package/dist/utils/customId.d.ts +7 -7
- package/dist/utils/customId.js +45 -45
- package/dist/utils/permissions.d.ts +2 -2
- package/dist/utils/permissions.js +8 -8
- package/dist/utils/recursiveImport.d.ts +4 -4
- package/dist/utils/recursiveImport.js +26 -26
- package/package.json +1 -1
- package/readme.md +5 -5
- package/src/methods/hookInteractionListeners.ts +7 -0
- package/src/types/SelectMenu.ts +2 -2
- package/src/types/SelectMenuBuilder.ts +3 -3
- 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`
|
|
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`
|
|
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`
|
|
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`
|
|
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`
|
|
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
|
|
package/src/types/SelectMenu.ts
CHANGED
|
@@ -23,11 +23,11 @@ export class DBISelectMenu<TNamespace extends NamespaceEnums> extends DBIBaseInt
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
declare options: Omit<Discord.
|
|
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.
|
|
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 {
|
|
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<
|
|
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():
|
|
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
|
-
})
|