@mostfeatured/dbi 0.1.47 → 0.2.1
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/src/DBI.d.ts.map +1 -0
- package/dist/src/DBI.js.map +1 -0
- package/dist/src/Events.d.ts.map +1 -0
- package/dist/src/Events.js.map +1 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/methods/handleMessageCommands.d.ts.map +1 -0
- package/dist/src/methods/handleMessageCommands.js.map +1 -0
- package/dist/src/methods/hookEventListeners.d.ts.map +1 -0
- package/dist/src/methods/hookEventListeners.js.map +1 -0
- package/dist/src/methods/hookInteractionListeners.d.ts.map +1 -0
- package/dist/{methods → src/methods}/hookInteractionListeners.js +22 -12
- package/dist/src/methods/hookInteractionListeners.js.map +1 -0
- package/dist/src/methods/publishInteractions.d.ts.map +1 -0
- package/dist/src/methods/publishInteractions.js.map +1 -0
- package/dist/src/types/ApplicationRoleConnectionMetadata.d.ts.map +1 -0
- package/dist/src/types/ApplicationRoleConnectionMetadata.js.map +1 -0
- package/dist/src/types/Builders/ButtonBuilder.d.ts.map +1 -0
- package/dist/src/types/Builders/ButtonBuilder.js.map +1 -0
- package/dist/src/types/Builders/ChannelSelectMenuBuilder.d.ts.map +1 -0
- package/dist/src/types/Builders/ChannelSelectMenuBuilder.js.map +1 -0
- package/dist/src/types/Builders/MentionableSelectMenuBuilder.d.ts.map +1 -0
- package/dist/src/types/Builders/MentionableSelectMenuBuilder.js.map +1 -0
- package/dist/src/types/Builders/ModalBuilder.d.ts.map +1 -0
- package/dist/src/types/Builders/ModalBuilder.js.map +1 -0
- package/dist/src/types/Builders/RoleSelectMenuBuilder.d.ts.map +1 -0
- package/dist/src/types/Builders/RoleSelectMenuBuilder.js.map +1 -0
- package/dist/src/types/Builders/StringSelectMenuBuilder.d.ts.map +1 -0
- package/dist/src/types/Builders/StringSelectMenuBuilder.js.map +1 -0
- package/dist/src/types/Builders/UserSelectMenuBuilder.d.ts.map +1 -0
- package/dist/src/types/Builders/UserSelectMenuBuilder.js.map +1 -0
- package/dist/src/types/ChatInput/ChatInput.d.ts.map +1 -0
- package/dist/src/types/ChatInput/ChatInput.js.map +1 -0
- package/dist/{types → src/types}/ChatInput/ChatInputOptions.d.ts +2 -2
- package/dist/src/types/ChatInput/ChatInputOptions.d.ts.map +1 -0
- package/dist/src/types/ChatInput/ChatInputOptions.js.map +1 -0
- package/dist/src/types/Components/Button.d.ts.map +1 -0
- package/dist/src/types/Components/Button.js.map +1 -0
- package/dist/src/types/Components/ChannelSelectMenu.d.ts.map +1 -0
- package/dist/src/types/Components/ChannelSelectMenu.js.map +1 -0
- package/dist/src/types/Components/HTMLComponentsV2/HTMLComponentsV2Handlers.d.ts.map +1 -0
- package/dist/src/types/Components/HTMLComponentsV2/HTMLComponentsV2Handlers.js.map +1 -0
- package/dist/src/types/Components/HTMLComponentsV2/index.d.ts +91 -0
- package/dist/src/types/Components/HTMLComponentsV2/index.d.ts.map +1 -0
- package/dist/src/types/Components/HTMLComponentsV2/index.js +300 -0
- package/dist/src/types/Components/HTMLComponentsV2/index.js.map +1 -0
- package/dist/src/types/Components/HTMLComponentsV2/parser.d.ts.map +1 -0
- package/dist/{types → src/types}/Components/HTMLComponentsV2/parser.js +11 -4
- package/dist/src/types/Components/HTMLComponentsV2/parser.js.map +1 -0
- package/dist/src/types/Components/HTMLComponentsV2/svelteParser.d.ts +35 -0
- package/dist/src/types/Components/HTMLComponentsV2/svelteParser.d.ts.map +1 -0
- package/dist/src/types/Components/HTMLComponentsV2/svelteParser.js +822 -0
- package/dist/src/types/Components/HTMLComponentsV2/svelteParser.js.map +1 -0
- package/dist/src/types/Components/HTMLComponentsV2/svelteRenderer.d.ts +24 -0
- package/dist/src/types/Components/HTMLComponentsV2/svelteRenderer.d.ts.map +1 -0
- package/dist/src/types/Components/HTMLComponentsV2/svelteRenderer.js +294 -0
- package/dist/src/types/Components/HTMLComponentsV2/svelteRenderer.js.map +1 -0
- package/dist/src/types/Components/MentionableSelectMenu.d.ts.map +1 -0
- package/dist/src/types/Components/MentionableSelectMenu.js.map +1 -0
- package/dist/src/types/Components/Modal.d.ts.map +1 -0
- package/dist/src/types/Components/Modal.js.map +1 -0
- package/dist/src/types/Components/RoleSelectMenu.d.ts.map +1 -0
- package/dist/src/types/Components/RoleSelectMenu.js.map +1 -0
- package/dist/src/types/Components/StringSelectMenu.d.ts.map +1 -0
- package/dist/src/types/Components/StringSelectMenu.js.map +1 -0
- package/dist/src/types/Components/UserSelectMenu.d.ts.map +1 -0
- package/dist/src/types/Components/UserSelectMenu.js.map +1 -0
- package/dist/src/types/Event.d.ts.map +1 -0
- package/dist/src/types/Event.js.map +1 -0
- package/dist/src/types/Interaction.d.ts.map +1 -0
- package/dist/src/types/Interaction.js.map +1 -0
- package/dist/src/types/other/CustomEvent.d.ts.map +1 -0
- package/dist/src/types/other/CustomEvent.js.map +1 -0
- package/dist/src/types/other/FakeMessageInteraction.d.ts.map +1 -0
- package/dist/src/types/other/FakeMessageInteraction.js.map +1 -0
- package/dist/src/types/other/InteractionLocale.d.ts.map +1 -0
- package/dist/src/types/other/InteractionLocale.js.map +1 -0
- package/dist/src/types/other/Locale.d.ts.map +1 -0
- package/dist/src/types/other/Locale.js.map +1 -0
- package/dist/src/types/other/MessageContextMenu.d.ts.map +1 -0
- package/dist/src/types/other/MessageContextMenu.js.map +1 -0
- package/dist/src/types/other/UserContextMenu.d.ts.map +1 -0
- package/dist/src/types/other/UserContextMenu.js.map +1 -0
- package/dist/src/utils/MemoryStore.d.ts.map +1 -0
- package/dist/src/utils/MemoryStore.js.map +1 -0
- package/dist/src/utils/UtilTypes.d.ts.map +1 -0
- package/dist/src/utils/UtilTypes.js.map +1 -0
- package/dist/src/utils/customId.d.ts.map +1 -0
- package/dist/src/utils/customId.js.map +1 -0
- package/dist/src/utils/permissions.d.ts.map +1 -0
- package/dist/src/utils/permissions.js.map +1 -0
- package/dist/src/utils/recursiveImport.d.ts.map +1 -0
- package/dist/src/utils/recursiveImport.js.map +1 -0
- package/dist/src/utils/recursiveUnload.d.ts.map +1 -0
- package/dist/src/utils/recursiveUnload.js.map +1 -0
- package/dist/src/utils/unloadModule.d.ts.map +1 -0
- package/dist/src/utils/unloadModule.js.map +1 -0
- package/dist/test/index.d.ts +2 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +103 -0
- package/dist/test/index.js.map +1 -0
- package/docs/ADVANCED_FEATURES.md +836 -0
- package/docs/API_REFERENCE.md +925 -0
- package/docs/CHAT_INPUT.md +807 -0
- package/docs/COMPONENTS.md +1035 -0
- package/docs/EVENTS.md +564 -0
- package/docs/GETTING_STARTED.md +394 -0
- package/docs/LOCALIZATION.md +773 -0
- package/docs/README.md +341 -0
- package/docs/SVELTE_COMPONENTS.md +955 -0
- package/generated/globals.d.ts +1 -0
- package/generated/index.d.ts +30 -0
- package/generated/svelte-dbi.d.ts +588 -0
- package/package.json +57 -47
- package/readme.md +168 -491
- package/src/methods/hookInteractionListeners.ts +23 -12
- package/src/types/Components/HTMLComponentsV2/index.ts +353 -12
- package/src/types/Components/HTMLComponentsV2/parser.ts +14 -4
- package/src/types/Components/HTMLComponentsV2/svelteParser.ts +904 -0
- package/src/types/Components/HTMLComponentsV2/svelteRenderer.ts +332 -0
- package/test/index.ts +105 -0
- package/test/product-showcase.svelte +199 -0
- package/tsconfig.json +13 -3
- package/dist/DBI.d.ts.map +0 -1
- package/dist/DBI.js.map +0 -1
- package/dist/Events.d.ts.map +0 -1
- package/dist/Events.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/methods/handleMessageCommands.d.ts.map +0 -1
- package/dist/methods/handleMessageCommands.js.map +0 -1
- package/dist/methods/hookEventListeners.d.ts.map +0 -1
- package/dist/methods/hookEventListeners.js.map +0 -1
- package/dist/methods/hookInteractionListeners.d.ts.map +0 -1
- package/dist/methods/hookInteractionListeners.js.map +0 -1
- package/dist/methods/publishInteractions.d.ts.map +0 -1
- package/dist/methods/publishInteractions.js.map +0 -1
- package/dist/types/ApplicationRoleConnectionMetadata.d.ts.map +0 -1
- package/dist/types/ApplicationRoleConnectionMetadata.js.map +0 -1
- package/dist/types/Builders/ButtonBuilder.d.ts.map +0 -1
- package/dist/types/Builders/ButtonBuilder.js.map +0 -1
- package/dist/types/Builders/ChannelSelectMenuBuilder.d.ts.map +0 -1
- package/dist/types/Builders/ChannelSelectMenuBuilder.js.map +0 -1
- package/dist/types/Builders/MentionableSelectMenuBuilder.d.ts.map +0 -1
- package/dist/types/Builders/MentionableSelectMenuBuilder.js.map +0 -1
- package/dist/types/Builders/ModalBuilder.d.ts.map +0 -1
- package/dist/types/Builders/ModalBuilder.js.map +0 -1
- package/dist/types/Builders/RoleSelectMenuBuilder.d.ts.map +0 -1
- package/dist/types/Builders/RoleSelectMenuBuilder.js.map +0 -1
- package/dist/types/Builders/StringSelectMenuBuilder.d.ts.map +0 -1
- package/dist/types/Builders/StringSelectMenuBuilder.js.map +0 -1
- package/dist/types/Builders/UserSelectMenuBuilder.d.ts.map +0 -1
- package/dist/types/Builders/UserSelectMenuBuilder.js.map +0 -1
- package/dist/types/ChatInput/ChatInput.d.ts.map +0 -1
- package/dist/types/ChatInput/ChatInput.js.map +0 -1
- package/dist/types/ChatInput/ChatInputOptions.d.ts.map +0 -1
- package/dist/types/ChatInput/ChatInputOptions.js.map +0 -1
- package/dist/types/Components/Button.d.ts.map +0 -1
- package/dist/types/Components/Button.js.map +0 -1
- package/dist/types/Components/ChannelSelectMenu.d.ts.map +0 -1
- package/dist/types/Components/ChannelSelectMenu.js.map +0 -1
- package/dist/types/Components/HTMLComponentsV2/HTMLComponentsV2Handlers.d.ts.map +0 -1
- package/dist/types/Components/HTMLComponentsV2/HTMLComponentsV2Handlers.js.map +0 -1
- package/dist/types/Components/HTMLComponentsV2/index.d.ts +0 -19
- package/dist/types/Components/HTMLComponentsV2/index.d.ts.map +0 -1
- package/dist/types/Components/HTMLComponentsV2/index.js +0 -31
- package/dist/types/Components/HTMLComponentsV2/index.js.map +0 -1
- package/dist/types/Components/HTMLComponentsV2/parser.d.ts.map +0 -1
- package/dist/types/Components/HTMLComponentsV2/parser.js.map +0 -1
- package/dist/types/Components/MentionableSelectMenu.d.ts.map +0 -1
- package/dist/types/Components/MentionableSelectMenu.js.map +0 -1
- package/dist/types/Components/Modal.d.ts.map +0 -1
- package/dist/types/Components/Modal.js.map +0 -1
- package/dist/types/Components/RoleSelectMenu.d.ts.map +0 -1
- package/dist/types/Components/RoleSelectMenu.js.map +0 -1
- package/dist/types/Components/StringSelectMenu.d.ts.map +0 -1
- package/dist/types/Components/StringSelectMenu.js.map +0 -1
- package/dist/types/Components/UserSelectMenu.d.ts.map +0 -1
- package/dist/types/Components/UserSelectMenu.js.map +0 -1
- package/dist/types/Event.d.ts.map +0 -1
- package/dist/types/Event.js.map +0 -1
- package/dist/types/Interaction.d.ts.map +0 -1
- package/dist/types/Interaction.js.map +0 -1
- package/dist/types/other/CustomEvent.d.ts.map +0 -1
- package/dist/types/other/CustomEvent.js.map +0 -1
- package/dist/types/other/FakeMessageInteraction.d.ts.map +0 -1
- package/dist/types/other/FakeMessageInteraction.js.map +0 -1
- package/dist/types/other/InteractionLocale.d.ts.map +0 -1
- package/dist/types/other/InteractionLocale.js.map +0 -1
- package/dist/types/other/Locale.d.ts.map +0 -1
- package/dist/types/other/Locale.js.map +0 -1
- package/dist/types/other/MessageContextMenu.d.ts.map +0 -1
- package/dist/types/other/MessageContextMenu.js.map +0 -1
- package/dist/types/other/UserContextMenu.d.ts.map +0 -1
- package/dist/types/other/UserContextMenu.js.map +0 -1
- package/dist/utils/MemoryStore.d.ts.map +0 -1
- package/dist/utils/MemoryStore.js.map +0 -1
- package/dist/utils/UtilTypes.d.ts.map +0 -1
- package/dist/utils/UtilTypes.js.map +0 -1
- package/dist/utils/customId.d.ts.map +0 -1
- package/dist/utils/customId.js.map +0 -1
- package/dist/utils/permissions.d.ts.map +0 -1
- package/dist/utils/permissions.js.map +0 -1
- package/dist/utils/recursiveImport.d.ts.map +0 -1
- package/dist/utils/recursiveImport.js.map +0 -1
- package/dist/utils/recursiveUnload.d.ts.map +0 -1
- package/dist/utils/recursiveUnload.js.map +0 -1
- package/dist/utils/unloadModule.d.ts.map +0 -1
- package/dist/utils/unloadModule.js.map +0 -1
- package/examples/modal/dbi.js +0 -30
- package/examples/modal/login.js +0 -15
- package/examples/modal/package.json +0 -15
- package/examples/modal/publish.js +0 -13
- package/examples/modal/src/chatInput.js +0 -38
- package/examples/modal/src/components.js +0 -33
- package/examples/modal/src/event.js +0 -20
- package/examples/modal/src/interactionlocales.js +0 -24
- package/examples/modal/src/locales.js +0 -38
- package/examples/modal/src/modal.js +0 -28
- /package/dist/{DBI.d.ts → src/DBI.d.ts} +0 -0
- /package/dist/{DBI.js → src/DBI.js} +0 -0
- /package/dist/{Events.d.ts → src/Events.d.ts} +0 -0
- /package/dist/{Events.js → src/Events.js} +0 -0
- /package/dist/{data → src/data}/eventMap.json +0 -0
- /package/dist/{index.d.ts → src/index.d.ts} +0 -0
- /package/dist/{index.js → src/index.js} +0 -0
- /package/dist/{methods → src/methods}/handleMessageCommands.d.ts +0 -0
- /package/dist/{methods → src/methods}/handleMessageCommands.js +0 -0
- /package/dist/{methods → src/methods}/hookEventListeners.d.ts +0 -0
- /package/dist/{methods → src/methods}/hookEventListeners.js +0 -0
- /package/dist/{methods → src/methods}/hookInteractionListeners.d.ts +0 -0
- /package/dist/{methods → src/methods}/publishInteractions.d.ts +0 -0
- /package/dist/{methods → src/methods}/publishInteractions.js +0 -0
- /package/dist/{types → src/types}/ApplicationRoleConnectionMetadata.d.ts +0 -0
- /package/dist/{types → src/types}/ApplicationRoleConnectionMetadata.js +0 -0
- /package/dist/{types → src/types}/Builders/ButtonBuilder.d.ts +0 -0
- /package/dist/{types → src/types}/Builders/ButtonBuilder.js +0 -0
- /package/dist/{types → src/types}/Builders/ChannelSelectMenuBuilder.d.ts +0 -0
- /package/dist/{types → src/types}/Builders/ChannelSelectMenuBuilder.js +0 -0
- /package/dist/{types → src/types}/Builders/MentionableSelectMenuBuilder.d.ts +0 -0
- /package/dist/{types → src/types}/Builders/MentionableSelectMenuBuilder.js +0 -0
- /package/dist/{types → src/types}/Builders/ModalBuilder.d.ts +0 -0
- /package/dist/{types → src/types}/Builders/ModalBuilder.js +0 -0
- /package/dist/{types → src/types}/Builders/RoleSelectMenuBuilder.d.ts +0 -0
- /package/dist/{types → src/types}/Builders/RoleSelectMenuBuilder.js +0 -0
- /package/dist/{types → src/types}/Builders/StringSelectMenuBuilder.d.ts +0 -0
- /package/dist/{types → src/types}/Builders/StringSelectMenuBuilder.js +0 -0
- /package/dist/{types → src/types}/Builders/UserSelectMenuBuilder.d.ts +0 -0
- /package/dist/{types → src/types}/Builders/UserSelectMenuBuilder.js +0 -0
- /package/dist/{types → src/types}/ChatInput/ChatInput.d.ts +0 -0
- /package/dist/{types → src/types}/ChatInput/ChatInput.js +0 -0
- /package/dist/{types → src/types}/ChatInput/ChatInputOptions.js +0 -0
- /package/dist/{types → src/types}/Components/Button.d.ts +0 -0
- /package/dist/{types → src/types}/Components/Button.js +0 -0
- /package/dist/{types → src/types}/Components/ChannelSelectMenu.d.ts +0 -0
- /package/dist/{types → src/types}/Components/ChannelSelectMenu.js +0 -0
- /package/dist/{types → src/types}/Components/HTMLComponentsV2/HTMLComponentsV2Handlers.d.ts +0 -0
- /package/dist/{types → src/types}/Components/HTMLComponentsV2/HTMLComponentsV2Handlers.js +0 -0
- /package/dist/{types → src/types}/Components/HTMLComponentsV2/parser.d.ts +0 -0
- /package/dist/{types → src/types}/Components/MentionableSelectMenu.d.ts +0 -0
- /package/dist/{types → src/types}/Components/MentionableSelectMenu.js +0 -0
- /package/dist/{types → src/types}/Components/Modal.d.ts +0 -0
- /package/dist/{types → src/types}/Components/Modal.js +0 -0
- /package/dist/{types → src/types}/Components/RoleSelectMenu.d.ts +0 -0
- /package/dist/{types → src/types}/Components/RoleSelectMenu.js +0 -0
- /package/dist/{types → src/types}/Components/StringSelectMenu.d.ts +0 -0
- /package/dist/{types → src/types}/Components/StringSelectMenu.js +0 -0
- /package/dist/{types → src/types}/Components/UserSelectMenu.d.ts +0 -0
- /package/dist/{types → src/types}/Components/UserSelectMenu.js +0 -0
- /package/dist/{types → src/types}/Event.d.ts +0 -0
- /package/dist/{types → src/types}/Event.js +0 -0
- /package/dist/{types → src/types}/Interaction.d.ts +0 -0
- /package/dist/{types → src/types}/Interaction.js +0 -0
- /package/dist/{types → src/types}/other/CustomEvent.d.ts +0 -0
- /package/dist/{types → src/types}/other/CustomEvent.js +0 -0
- /package/dist/{types → src/types}/other/FakeMessageInteraction.d.ts +0 -0
- /package/dist/{types → src/types}/other/FakeMessageInteraction.js +0 -0
- /package/dist/{types → src/types}/other/InteractionLocale.d.ts +0 -0
- /package/dist/{types → src/types}/other/InteractionLocale.js +0 -0
- /package/dist/{types → src/types}/other/Locale.d.ts +0 -0
- /package/dist/{types → src/types}/other/Locale.js +0 -0
- /package/dist/{types → src/types}/other/MessageContextMenu.d.ts +0 -0
- /package/dist/{types → src/types}/other/MessageContextMenu.js +0 -0
- /package/dist/{types → src/types}/other/UserContextMenu.d.ts +0 -0
- /package/dist/{types → src/types}/other/UserContextMenu.js +0 -0
- /package/dist/{utils → src/utils}/MemoryStore.d.ts +0 -0
- /package/dist/{utils → src/utils}/MemoryStore.js +0 -0
- /package/dist/{utils → src/utils}/UtilTypes.d.ts +0 -0
- /package/dist/{utils → src/utils}/UtilTypes.js +0 -0
- /package/dist/{utils → src/utils}/customId.d.ts +0 -0
- /package/dist/{utils → src/utils}/customId.js +0 -0
- /package/dist/{utils → src/utils}/permissions.d.ts +0 -0
- /package/dist/{utils → src/utils}/permissions.js +0 -0
- /package/dist/{utils → src/utils}/recursiveImport.d.ts +0 -0
- /package/dist/{utils → src/utils}/recursiveImport.js +0 -0
- /package/dist/{utils → src/utils}/recursiveUnload.d.ts +0 -0
- /package/dist/{utils → src/utils}/recursiveUnload.js +0 -0
- /package/dist/{utils → src/utils}/unloadModule.d.ts +0 -0
- /package/dist/{utils → src/utils}/unloadModule.js +0 -0
package/readme.md
CHANGED
|
@@ -1,592 +1,269 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# 🤖 DBI - Discord Bot Infrastructure
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/@mostfeatured/dbi)
|
|
6
|
+
[](https://www.npmjs.com/package/@mostfeatured/dbi)
|
|
7
|
+
[](LICENSE)
|
|
6
8
|
|
|
7
|
-
The
|
|
9
|
+
**The most advanced, modern, and developer-friendly Discord.js v14 bot infrastructure.**
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
[Getting Started](#-quick-start) •
|
|
12
|
+
[Features](#-features) •
|
|
13
|
+
[Documentation](#-documentation) •
|
|
14
|
+
[Examples](#-examples)
|
|
10
15
|
|
|
11
|
-
|
|
16
|
+
</div>
|
|
12
17
|
|
|
13
|
-
|
|
18
|
+
---
|
|
14
19
|
|
|
15
|
-
|
|
16
|
-
```js
|
|
17
|
-
const { createDBI } = require("@mostfeatured/dbi");
|
|
18
|
-
let dbi = createDBI("xd", {
|
|
19
|
-
strict: true,
|
|
20
|
-
discord: {
|
|
21
|
-
token: "<yourTokenHere>",
|
|
22
|
-
options: {
|
|
23
|
-
intents: [
|
|
24
|
-
"Guilds"
|
|
25
|
-
]
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
defaults: {
|
|
29
|
-
locale: {
|
|
30
|
-
name: "en"
|
|
31
|
-
},
|
|
32
|
-
defaultMemberPermissions: ["SendMessages"],
|
|
33
|
-
directMessages: false
|
|
34
|
-
},
|
|
35
|
-
references: {
|
|
36
|
-
autoClear: {
|
|
37
|
-
ttl: 60 * 1000 * 60,
|
|
38
|
-
check: 60 * 1000
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
// Message Commands are optional. Message Commands work trough emulating the slash commands..
|
|
42
|
-
messageCommands: {
|
|
43
|
-
prefixes: ["!", "."],
|
|
44
|
-
typeAliases: {
|
|
45
|
-
booleans: {
|
|
46
|
-
"true": true,
|
|
47
|
-
"false": false,
|
|
48
|
-
"yes": true,
|
|
49
|
-
"no": false,
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
dbi.events.on("messageCommandArgumentError", (data) => {
|
|
56
|
-
data.message.reply(`‼️ Invalid argument \`${data.error.option.name}\` (Index: \`${data.error.index}\`). Error Kind: \`${data.error.type}\`. Expected: \`${ApplicationCommandOptionType[data.error.option.type]}\`${data.error.extra ? ` with any of \`${data.error.extra.map(i => i.name).join(", ")}\`` : ""}.`);
|
|
57
|
-
return false;
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
module.exports = dbi;
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
We start the infrastructure with the `createDBI()` function. The first parameter of the function is your bot's 'codeName' and the second parameter is your bot's configuration.
|
|
64
|
-
|
|
65
|
-
As the second step, we open our `login.js` file and write the code group that we will use to open the bot.
|
|
66
|
-
```js
|
|
67
|
-
const { Utils } = require("@mostfeatured/dbi");
|
|
68
|
-
const dbi = require("./dbi");
|
|
69
|
-
(async () => {
|
|
70
|
-
await Utils.recursiveImport("./src");
|
|
71
|
-
await dbi.load();
|
|
72
|
-
await dbi.login();
|
|
73
|
-
await dbi.client.user.setActivity({
|
|
74
|
-
name: "MostFeatured ❤️ TheArmagan"
|
|
75
|
-
});
|
|
76
|
-
console.log(`Logged in! ${dbi.client.user.tag} (${dbi.client.user.id})`);
|
|
77
|
-
})();
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
We import the `Utils.recursiveImport()` function into it. With this function we can `import`/`require` all files in `x` folder endlessly. In this way, the infrastructure is aware of these files.
|
|
81
|
-
We access our infrastructure from our main `dbi.js` file and create an `async` environment and first define all project files to the infrastructure. After the definition, we load all the features we have defined to the infrastructure with the `load()` function. Right after, we log in to Discord with the `login()` function.
|
|
82
|
-
|
|
83
|
-
As the 3rd step, we open our `publish.js` file and repeat all the operations we did in the second step.
|
|
84
|
-
```js
|
|
85
|
-
const { Utils } = require("@mostfeatured/dbi");
|
|
86
|
-
const dbi = require("./dbi");
|
|
87
|
-
(async () => {
|
|
88
|
-
await Utils.recursiveImport("./src");
|
|
89
|
-
await dbi.load();
|
|
90
|
-
await dbi.publish("Guild", "<yourGuildId>");
|
|
91
|
-
// await dbi.publish("Global");
|
|
92
|
-
await dbi.unload();
|
|
93
|
-
console.log("Published!");
|
|
94
|
-
})();
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
However, instead of calling the `login()` function, we call the `publish()` function and with this function we introduce the commands of our bot wherever we want.
|
|
98
|
-
|
|
99
|
-
# Fantastic!
|
|
100
|
-
|
|
101
|
-
We now have all the necessary files to use the infrastructure. (Information: If these steps that we have explained in detail are complex and difficult for you, we are sorry that this infrastructure is not suitable for you.)
|
|
102
|
-
|
|
103
|
-
# Detailed Usage Scenario
|
|
104
|
-
|
|
105
|
-
You can fully use all kinds of Discord's features with our specially developed infrastructure that fully supports v14. (`ChatInput`, `Event`, `Locale`, `Button`, `SelectMenu`, `MessageContextMenu`, `UserContextMenu`, `Modal`, `InteractionLocale`)
|
|
106
|
-
|
|
107
|
-
Now we want to show you how to define properties in infrastructure. Example: (ChatInput/Button etc.)
|
|
108
|
-
|
|
109
|
-
First, we include the relevant feature in our infrastructure.
|
|
110
|
-
```js
|
|
111
|
-
const dbi = require("../dbi");
|
|
112
|
-
```
|
|
113
|
-
And then we call the `register()` function on the infrastructure and put a `callback` function in it. This `callback` function presents as the first parameter everything you can define on the infrastructure as an object. You can perform the definition to the infrastructure by calling the feature function you want from this object.
|
|
114
|
-
```js
|
|
115
|
-
dbi.register(({ ChatInput, Event }) => {
|
|
116
|
-
ChatInput({ ... });
|
|
117
|
-
Event({ ... });
|
|
118
|
-
})
|
|
119
|
-
```
|
|
120
|
-
Remember, you can summon as many features as you want at the same time!
|
|
121
|
-
|
|
122
|
-
# ChatInput & ChatInputOptions
|
|
123
|
-
|
|
124
|
-
`ChatInput` is defined as "Slash Command" as you can understand.
|
|
125
|
-
|
|
126
|
-
<sub>`src/chatInput.js` file:</sub>
|
|
127
|
-
|
|
128
|
-
```js
|
|
129
|
-
const dbi = require("../dbi");
|
|
130
|
-
const Discord = require("discord.js");
|
|
20
|
+
## ✨ Features
|
|
131
21
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
components: [
|
|
147
|
-
dbi.interaction("viewGender").toJSON({ overrides: { label: locale.user.data.clickText() }, reference: { ttl: 1000 * 60 * 10, data: [gender] } }),
|
|
148
|
-
]
|
|
149
|
-
}
|
|
150
|
-
]
|
|
151
|
-
});
|
|
152
|
-
},
|
|
153
|
-
options: [
|
|
154
|
-
ChatInputOptions.stringChoices({
|
|
155
|
-
name: "cinsiyet",
|
|
156
|
-
description: "Seçeceğiniz cinsiyet.",
|
|
157
|
-
required: true,
|
|
158
|
-
choices: [
|
|
159
|
-
{ name: "Erkek", value: "erkek" },
|
|
160
|
-
{ name: "Kadın", value: "kadın" },
|
|
161
|
-
{ name: "Diğer", value: "diğer" },
|
|
162
|
-
]
|
|
163
|
-
})
|
|
164
|
-
],
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
```
|
|
168
|
-
In general, the structure of `ChatInput` may seem familiar to you, except for `options`. When you try to fill something in options directly, you will not get autocomplete. Because options expect static functions in ChatInputOptions class. The functions are similar to: `stringChoices`, `user`, `numberAutocomplete` etc.
|
|
169
|
-
You can also find more examples below for a sample demonstration of how the Locale and Component system we have shown above is used.
|
|
22
|
+
| Feature | Description |
|
|
23
|
+
|---------|-------------|
|
|
24
|
+
| 🎯 **Slash Commands** | Full support with 14 option types, autocomplete, and subcommands |
|
|
25
|
+
| 🔘 **Components** | Buttons, Select Menus (5 types), and Modals with built-in state management |
|
|
26
|
+
| 🌍 **Localization** | Multi-language support for both content and command translations |
|
|
27
|
+
| 📨 **Events** | Discord events, custom events, and internal DBI events |
|
|
28
|
+
| 💬 **Message Commands** | Automatic slash command emulation from prefix commands |
|
|
29
|
+
| 🔗 **Reference System** | Pass complex data through component interactions |
|
|
30
|
+
| 🚀 **Multi-Client** | Run multiple bots with namespace isolation |
|
|
31
|
+
| ⚡ **Hybrid Sharding** | Scale to millions of servers with discord-hybrid-sharding |
|
|
32
|
+
| 🎨 **Svelte Components** | Build reactive Discord UIs with Svelte 5 (HTMLComponentsV2) |
|
|
33
|
+
| 🔄 **Hot Reloading** | Update features without restarting your bot |
|
|
34
|
+
| 🛡️ **Rate Limiting** | Built-in rate limit management per user/channel/guild |
|
|
35
|
+
| 📝 **TypeScript** | Full type safety with intelligent autocomplete |
|
|
170
36
|
|
|
171
|
-
|
|
37
|
+
---
|
|
172
38
|
|
|
173
|
-
|
|
39
|
+
## 📦 Installation
|
|
174
40
|
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
dbi.register(({ Event }) => {
|
|
178
|
-
Event({
|
|
179
|
-
name: "ready",
|
|
180
|
-
id: "botIsReady",
|
|
181
|
-
onExecute() {
|
|
182
|
-
console.log(`Bot ready!`);
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
});
|
|
41
|
+
```bash
|
|
42
|
+
npm install @mostfeatured/dbi discord.js
|
|
186
43
|
```
|
|
187
|
-
When defining an event, you can write the name of the event you want in the `name` field. However, if you want to open more than one of the same event, you need to define an 'id' for that event.
|
|
188
|
-
|
|
189
|
-
# Locale
|
|
190
|
-
|
|
191
|
-
<sub>`src/locales.js` file:</sub>
|
|
192
|
-
|
|
193
|
-
```js
|
|
194
|
-
const dbi = require("../dbi");
|
|
195
|
-
dbi.register(({ Locale }) => {
|
|
196
|
-
Locale({
|
|
197
|
-
name: "tr",
|
|
198
|
-
data: {
|
|
199
|
-
genders: {
|
|
200
|
-
erkek: "Erkek",
|
|
201
|
-
kadın: "Kadın",
|
|
202
|
-
diğer: "Diğer"
|
|
203
|
-
},
|
|
204
|
-
genderText: "{0} adlı üye {1} cinsiyetini seçti."
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
Locale({
|
|
208
|
-
name: "en",
|
|
209
|
-
data: {
|
|
210
|
-
genders: {
|
|
211
|
-
erkek: "Male",
|
|
212
|
-
kadın: "Female",
|
|
213
|
-
diğer: "Other"
|
|
214
|
-
},
|
|
215
|
-
genderText: "{0}, picked {1} gender."
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
});
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
Thanks to Locale, there is information in each interaction that will make it easier for you to respond according to the language of the user or the server. The `name` in Locale contains the values you want to keep, and the `data` part for which language you define. The `{0}` and `{1}` signs in the text are also our variables in the text. When using locale, we can take the value we want and call it like a function. And in it we give the parameters respectively. For example `locale.data.genderText(user, gender)`.
|
|
222
|
-
|
|
223
|
-
# Button & SelectMenu & Modal
|
|
224
|
-
|
|
225
|
-
In this section, we will look at three of our features. (Actually, it's all the same feature in the background.)
|
|
226
|
-
|
|
227
|
-
<sub>`src/components.js` file:</sub>
|
|
228
|
-
|
|
229
|
-
```js
|
|
230
|
-
const dbi = require("../dbi");
|
|
231
|
-
const Discord = require("discord.js");
|
|
232
|
-
dbi.register(({ Button, SelectMenu, Modal }) => {
|
|
233
|
-
Button({
|
|
234
|
-
name: "viewGender",
|
|
235
|
-
onExecute({ interaction, data }) {
|
|
236
|
-
interaction.reply(`\`${data[0]}\``);
|
|
237
|
-
},
|
|
238
|
-
options: {
|
|
239
|
-
style: Discord.ButtonStyle.Primary,
|
|
240
|
-
label: "View Gender"
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
});
|
|
244
|
-
```
|
|
245
|
-
We bring you a very cool and cool feature about Button & SelectMenu & Modal. Now you can move the value you want on them. (Like Reference/Object or text/number.) For example `dbi.interaction("viewGender").toJSON("male")` will provide us a valid component powered by Discord.js. And you can reach the value presented in the json both by turning the `options` part into a function and when the interaction itself is called. There is one thing you should not forget about this subject. If you are going to carry plain text or numbers, the total length of these texts or numbers should not exceed 100 characters. Because these values are carried directly on the button and they work in such a way that they remain there even if you turn the bot off and on.
|
|
246
|
-
|
|
247
|
-
# MessageContextMenu & UserContextMenu
|
|
248
|
-
|
|
249
|
-
It has exactly the same properties as `ChatInput` but does not take `options` value.
|
|
250
44
|
|
|
251
|
-
|
|
45
|
+
---
|
|
252
46
|
|
|
253
|
-
|
|
254
|
-
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.)
|
|
47
|
+
## 🚀 Quick Start
|
|
255
48
|
|
|
256
|
-
|
|
49
|
+
### 1. Create DBI Instance
|
|
257
50
|
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
dbi.register(({ InteractionLocale }) => {
|
|
261
|
-
InteractionLocale({
|
|
262
|
-
name: "cinsiyet seç",
|
|
263
|
-
data: {
|
|
264
|
-
en: {
|
|
265
|
-
name: "select gender",
|
|
266
|
-
description: "Allows you to select a gender.",
|
|
267
|
-
options: {
|
|
268
|
-
cinsiyet: {
|
|
269
|
-
name: "gender",
|
|
270
|
-
description: "Select your gender correctly.",
|
|
271
|
-
choices: {
|
|
272
|
-
"Erkek": "Male",
|
|
273
|
-
"Kadın": "Female",
|
|
274
|
-
"Diğer": "Other"
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
});
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
Final note: The value `name` for `InteractionLocale` will be the name of one of the other interactions you define. For example `select gender`. We tried to simplify Data's structure. First you select the language you want and then you fill in the content as in the example. You can add how it will appear in as many languages as you want at the same time.
|
|
285
|
-
|
|
286
|
-
You can contact me via Discord for errors or similar issues. (Armagan#4869)
|
|
287
|
-
|
|
288
|
-
Remember: "There will always be something free and valuable on earth."
|
|
289
|
-
|
|
290
|
-
<sub>12.09.2022: Original text written by TheArmagan, edited by Maschera. </sub>
|
|
291
|
-
|
|
292
|
-
# DiscordBotInfrastructure - [Turkish]
|
|
293
|
-
|
|
294
|
-
İnternet üzerinde bulabileceğiniz en gelişmiş, güncel ve kullanımı basit Discord bot altyapısı.
|
|
295
|
-
|
|
296
|
-
# Kullanım Senaryosu
|
|
297
|
-
|
|
298
|
-
MostFeatured/DiscordBotInfrastructure projesi diğer alışık olduğunuz altyapılar gibi kendi halinde bir proje değil, bir NPM modülüdür. Bu bağlamda kullanmaya başlamadan önce bir klasör açmanız ve içerisine `npm install @mostfeatured/dbi discord.js` komutunu girerek altyapıyı ve discord.js'i indirmeniz gerekmektedir.
|
|
299
|
-
|
|
300
|
-
# Başlarken
|
|
301
|
-
|
|
302
|
-
İlk olarak `3 dosya` ve `1 klasöre` ihitiyacımız olacak. Bu yapı tamamen sizin çalışma düzeninize uygun olarak konfigüre edilebilmektedir. Lakin bizim önerdiğimiz senaryo aşağıdaki gibidir.
|
|
303
|
-
|
|
304
|
-
Açılması gereken dosyalar ve klasörler; `dbi.js`, `login.js`, `publish.js` dosyaları ve `src` klasörü.
|
|
305
|
-
|
|
306
|
-
1. adım olarak `dbi.js` adındaki dosyamızı açıyoruz ve içerisine altyapının temellerini atıyoruz.
|
|
307
|
-
```js
|
|
51
|
+
```javascript
|
|
52
|
+
// dbi.js
|
|
308
53
|
const { createDBI } = require("@mostfeatured/dbi");
|
|
309
54
|
|
|
310
|
-
|
|
55
|
+
const dbi = createDBI("my-bot", {
|
|
311
56
|
strict: true,
|
|
312
57
|
discord: {
|
|
313
|
-
token:
|
|
314
|
-
options: {
|
|
315
|
-
intents: [
|
|
316
|
-
"Guilds"
|
|
317
|
-
]
|
|
318
|
-
}
|
|
58
|
+
token: process.env.DISCORD_TOKEN,
|
|
59
|
+
options: { intents: ["Guilds"] }
|
|
319
60
|
},
|
|
320
61
|
defaults: {
|
|
321
|
-
locale: "en",
|
|
322
|
-
defaultMemberPermissions: ["SendMessages"],
|
|
62
|
+
locale: { name: "en" },
|
|
323
63
|
directMessages: false
|
|
324
|
-
},
|
|
325
|
-
references: {
|
|
326
|
-
autoClear: {
|
|
327
|
-
ttl: 60 * 1000 * 60,
|
|
328
|
-
check: 60 * 1000
|
|
329
|
-
}
|
|
330
|
-
},
|
|
331
|
-
// Mesaj Komutları isteğe bağlıdır. Mesaj Komutları slash komutlarını taklit ederek çalışır. Yani siz sadece slash komut kodlasanız bile uyumlu olarak çalışacaktır.
|
|
332
|
-
messageCommands: {
|
|
333
|
-
prefixes: ["!", "."],
|
|
334
|
-
typeAliases: {
|
|
335
|
-
booleans: {
|
|
336
|
-
"true": true,
|
|
337
|
-
"false": false,
|
|
338
|
-
"yes": true,
|
|
339
|
-
"no": false,
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
64
|
}
|
|
343
65
|
});
|
|
344
66
|
|
|
345
|
-
dbi.events.on("messageCommandArgumentError", (data) => {
|
|
346
|
-
data.message.reply(`‼️ Hatalı argument \`${data.error.option.name}\` (Konum: \`${data.error.index}\`). Hata Tipi: \`${data.error.type}\`. Beklenen: \`${ApplicationCommandOptionType[data.error.option.type]}\`${data.error.extra ? ` şunlardan herhangi biri \`${data.error.extra.map(i => i.name).join(", ")}\`` : ""}.`);
|
|
347
|
-
return false;
|
|
348
|
-
});
|
|
349
|
-
|
|
350
67
|
module.exports = dbi;
|
|
351
68
|
```
|
|
352
69
|
|
|
353
|
-
|
|
70
|
+
### 2. Define Features
|
|
71
|
+
|
|
72
|
+
```javascript
|
|
73
|
+
// src/commands/ping.js
|
|
74
|
+
const dbi = require("../dbi");
|
|
75
|
+
|
|
76
|
+
dbi.register(({ ChatInput }) => {
|
|
77
|
+
ChatInput({
|
|
78
|
+
name: "ping",
|
|
79
|
+
description: "Check bot latency",
|
|
80
|
+
onExecute({ interaction, dbi }) {
|
|
81
|
+
interaction.reply(`🏓 Pong! ${dbi.client().client.ws.ping}ms`);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 3. Start Bot
|
|
354
88
|
|
|
355
|
-
|
|
356
|
-
|
|
89
|
+
```javascript
|
|
90
|
+
// index.js
|
|
357
91
|
const { Utils } = require("@mostfeatured/dbi");
|
|
358
92
|
const dbi = require("./dbi");
|
|
359
93
|
|
|
360
94
|
(async () => {
|
|
361
95
|
await Utils.recursiveImport("./src");
|
|
362
|
-
|
|
363
96
|
await dbi.load();
|
|
364
97
|
await dbi.login();
|
|
365
|
-
|
|
366
|
-
await dbi.client.user.setActivity({
|
|
367
|
-
name: "MostFeatured ❤️ TheArmagan"
|
|
368
|
-
});
|
|
369
|
-
|
|
370
|
-
console.log(`Logged in! ${dbi.client.user.tag} (${dbi.client.user.id})`);
|
|
98
|
+
console.log(`✅ Logged in as ${dbi.client().client.user.tag}`);
|
|
371
99
|
})();
|
|
372
100
|
```
|
|
373
101
|
|
|
374
|
-
|
|
375
|
-
Ana `dbi.js` dosyamızdan altyapımıza ulaşıyoruz ve `async` bir ortam oluşturup ilk önce tüm proje dosylarını altyapıya tanımlıyoruz. Tanımlamanın ardından tanımladığımız tüm özellikleri altyapıya `load()` fonksiyonunu ile yüklüyoruz. Hemen ardından `login()` fonksiyonu ile Discord'a giriş sağlıyoruz.
|
|
376
|
-
|
|
102
|
+
### 4. Publish Commands
|
|
377
103
|
|
|
378
|
-
|
|
379
|
-
|
|
104
|
+
```javascript
|
|
105
|
+
// publish.js
|
|
380
106
|
const { Utils } = require("@mostfeatured/dbi");
|
|
381
107
|
const dbi = require("./dbi");
|
|
382
108
|
|
|
383
109
|
(async () => {
|
|
384
110
|
await Utils.recursiveImport("./src");
|
|
385
|
-
|
|
386
111
|
await dbi.load();
|
|
387
|
-
await dbi.publish("Guild", "
|
|
388
|
-
// await dbi.publish("Global");
|
|
112
|
+
await dbi.publish("Global"); // or dbi.publish("Guild", "GUILD_ID")
|
|
389
113
|
await dbi.unload();
|
|
390
|
-
|
|
391
|
-
console.log("Published!");
|
|
114
|
+
console.log("✅ Commands published!");
|
|
392
115
|
})();
|
|
393
116
|
```
|
|
394
117
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
# Harika!
|
|
118
|
+
---
|
|
398
119
|
|
|
399
|
-
|
|
120
|
+
## 💡 Examples
|
|
400
121
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
Özel olarak geliştirdiğimiz ve v14'ü eksiksiz bir şekilde destekleyen altyapımız ile Discord'un her türlü özelliğini tam anlamıyla kullanabiliyorsunuz. (`ChatInput`, `Event`, `Locale`, `Button`, `SelectMenu`, `MessageContextMenu`, `UserContextMenu`, `Modal`, `InteractionLocale`)
|
|
404
|
-
|
|
405
|
-
Şimdi sizlere altyapıya özellik tanımlamayı göstermek istiyoruz. Örnek: (ChatInput/Button vb.)
|
|
406
|
-
|
|
407
|
-
İlk olarak ilgili özelliği altyapımıza dahil ediyoruz.
|
|
408
|
-
```js
|
|
409
|
-
const dbi = require("../dbi");
|
|
410
|
-
```
|
|
411
|
-
Ve devamında altyapının üzerindeki `register()` fonksiyonunu çağırıp içerisine bir `callback` fonksiyonu koyuyoruz. Bu `callback` fonksiyonu ilk parametre olarak size altyapı üzerine tanımlayabilceğiniz tüm her şeyi bir obje olarak sunuyor. Bu obje içerisinden istediğiniz özellik fonksiyonunu çağırarak altyapıya tanımlama işlemini gerçekleştirebiliyorsunuz.
|
|
412
|
-
```js
|
|
413
|
-
dbi.register(({ ChatInput, Event }) => {
|
|
414
|
-
ChatInput({ ... });
|
|
415
|
-
Event({ ... });
|
|
416
|
-
})
|
|
417
|
-
```
|
|
418
|
-
Unutmayın ki aynı anda istediğiniz kadar özelliği çağırabilirsiniz!
|
|
419
|
-
|
|
420
|
-
# ChatInput & ChatInputOptions
|
|
421
|
-
|
|
422
|
-
`ChatInput` sizin anlayacağınız şekilde "Slash Komut" olarak tanımlanmaktadır.
|
|
423
|
-
|
|
424
|
-
<sub>`src/chatInput.js` dosyası:</sub>
|
|
425
|
-
|
|
426
|
-
```js
|
|
427
|
-
const dbi = require("../dbi");
|
|
428
|
-
const Discord = require("discord.js");
|
|
122
|
+
### Slash Command with Options
|
|
429
123
|
|
|
124
|
+
```javascript
|
|
430
125
|
dbi.register(({ ChatInput, ChatInputOptions }) => {
|
|
431
126
|
ChatInput({
|
|
432
|
-
name: "
|
|
433
|
-
description: "
|
|
434
|
-
onExecute({ interaction, locale }) {
|
|
435
|
-
let gender = interaction.options.get("cinsiyet").value;
|
|
436
|
-
let genderNames = locale.user.data.genders;
|
|
437
|
-
let genderText = locale.user.data.genderText(interaction.user, genderNames[gender]());
|
|
438
|
-
interaction.reply({
|
|
439
|
-
content: genderText,
|
|
440
|
-
components: [
|
|
441
|
-
{
|
|
442
|
-
type: Discord.ComponentType.ActionRow,
|
|
443
|
-
components: [
|
|
444
|
-
dbi.interaction("viewGender").toJSON({ overrides: { label: locale.user.data.clickText() }, reference: { ttl: 1000 * 60 * 10, data: [gender] } }),
|
|
445
|
-
]
|
|
446
|
-
}
|
|
447
|
-
]
|
|
448
|
-
});
|
|
449
|
-
},
|
|
127
|
+
name: "greet",
|
|
128
|
+
description: "Greet a user",
|
|
450
129
|
options: [
|
|
451
|
-
ChatInputOptions.
|
|
452
|
-
name: "
|
|
453
|
-
description: "
|
|
454
|
-
required: true
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
]
|
|
130
|
+
ChatInputOptions.user({
|
|
131
|
+
name: "target",
|
|
132
|
+
description: "User to greet",
|
|
133
|
+
required: true
|
|
134
|
+
}),
|
|
135
|
+
ChatInputOptions.string({
|
|
136
|
+
name: "message",
|
|
137
|
+
description: "Custom message"
|
|
460
138
|
})
|
|
461
139
|
],
|
|
140
|
+
onExecute({ interaction }) {
|
|
141
|
+
const user = interaction.options.getUser("target");
|
|
142
|
+
const message = interaction.options.getString("message") || "Hello!";
|
|
143
|
+
interaction.reply(`${message}, ${user}!`);
|
|
144
|
+
}
|
|
462
145
|
});
|
|
463
146
|
});
|
|
464
147
|
```
|
|
465
|
-
Genel olarak `ChatInput`'un yapısı gözünüze `options` dışında tanıdık gelmiş olabilir. Direkt olarak options içerisine bir şey doldurmaya çalıştığınızda otomatik tamamlama alamayacaksınız. Çünkü options içerisinde ChatInputOptions class'ındaki statik fonksiyonlardan beklemekte. Fonksiyonlar ise şunlara benzemekte; `stringChoices`, `user`, `numberAutocomplete` vb.
|
|
466
|
-
Ayrıca yukarıda göstermiş olduğumuz Locale ve Component sisteminin nasıl kullanıldığıyla ilgili örnek gösterim için aşağıdan daha fazla örneğe ulaşabilirsiniz.
|
|
467
148
|
|
|
468
|
-
|
|
149
|
+
### Button with Reference Data
|
|
469
150
|
|
|
470
|
-
|
|
151
|
+
```javascript
|
|
152
|
+
const Discord = require("discord.js");
|
|
471
153
|
|
|
472
|
-
|
|
473
|
-
|
|
154
|
+
dbi.register(({ ChatInput, Button }) => {
|
|
155
|
+
ChatInput({
|
|
156
|
+
name: "shop",
|
|
157
|
+
description: "View the shop",
|
|
158
|
+
onExecute({ interaction, dbi }) {
|
|
159
|
+
interaction.reply({
|
|
160
|
+
content: "🛒 Welcome to the shop!",
|
|
161
|
+
components: [{
|
|
162
|
+
type: Discord.ComponentType.ActionRow,
|
|
163
|
+
components: [
|
|
164
|
+
dbi.interaction("buy-item").toJSON({
|
|
165
|
+
overrides: { label: "Buy Sword - 100g" },
|
|
166
|
+
reference: { data: ["sword", 100] }
|
|
167
|
+
})
|
|
168
|
+
]
|
|
169
|
+
}]
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
});
|
|
474
173
|
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
174
|
+
Button({
|
|
175
|
+
name: "buy-item",
|
|
176
|
+
options: { style: Discord.ButtonStyle.Primary },
|
|
177
|
+
onExecute({ interaction, data }) {
|
|
178
|
+
const [item, price] = data;
|
|
179
|
+
interaction.reply(`✅ You bought **${item}** for **${price}g**!`);
|
|
481
180
|
}
|
|
482
181
|
});
|
|
483
182
|
});
|
|
484
183
|
```
|
|
485
|
-
Event yani olay tanımlarken `name` kısmına istediğiniz olayın ismini yazabilirsiniz. Ancak eğer aynı olaydan birden fazla açmak istiyorsanız o olaya bir `id` tanımlamanız gerekmektedir.
|
|
486
|
-
|
|
487
|
-
# Locale
|
|
488
184
|
|
|
489
|
-
|
|
185
|
+
### Multi-Language Support
|
|
490
186
|
|
|
491
|
-
```
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
dbi.register(({ Locale }) => {
|
|
187
|
+
```javascript
|
|
188
|
+
dbi.register(({ Locale, ChatInput }) => {
|
|
495
189
|
Locale({
|
|
496
|
-
name: "
|
|
190
|
+
name: "en",
|
|
497
191
|
data: {
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
kadın: "Kadın",
|
|
501
|
-
diğer: "Diğer"
|
|
502
|
-
},
|
|
503
|
-
genderText: "{0} adlı üye {1} cinsiyetini seçti."
|
|
192
|
+
greeting: "Hello, {0}!",
|
|
193
|
+
farewell: "Goodbye!"
|
|
504
194
|
}
|
|
505
195
|
});
|
|
506
196
|
|
|
507
197
|
Locale({
|
|
508
|
-
name: "
|
|
198
|
+
name: "tr",
|
|
509
199
|
data: {
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
200
|
+
greeting: "Merhaba, {0}!",
|
|
201
|
+
farewell: "Hoşça kal!"
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
ChatInput({
|
|
206
|
+
name: "hello",
|
|
207
|
+
description: "Say hello",
|
|
208
|
+
onExecute({ interaction, locale }) {
|
|
209
|
+
const greeting = locale.user.data.greeting(interaction.user.username);
|
|
210
|
+
interaction.reply(greeting);
|
|
516
211
|
}
|
|
517
212
|
});
|
|
518
213
|
});
|
|
519
214
|
```
|
|
520
215
|
|
|
521
|
-
|
|
216
|
+
---
|
|
522
217
|
|
|
523
|
-
|
|
218
|
+
## 📚 Documentation
|
|
524
219
|
|
|
525
|
-
|
|
220
|
+
Comprehensive documentation is available in the [docs](./docs/) folder:
|
|
526
221
|
|
|
527
|
-
|
|
222
|
+
| Document | Description |
|
|
223
|
+
|----------|-------------|
|
|
224
|
+
| [Getting Started](./docs/GETTING_STARTED.md) | Installation, setup, and project structure |
|
|
225
|
+
| [Chat Input](./docs/CHAT_INPUT.md) | Slash commands, options, and autocomplete |
|
|
226
|
+
| [Components](./docs/COMPONENTS.md) | Buttons, select menus, and modals |
|
|
227
|
+
| [Events](./docs/EVENTS.md) | Discord events, custom events, DBI events |
|
|
228
|
+
| [Localization](./docs/LOCALIZATION.md) | Multi-language support |
|
|
229
|
+
| [Advanced Features](./docs/ADVANCED_FEATURES.md) | Message commands, sharding, multi-client |
|
|
230
|
+
| [Svelte Components](./docs/SVELTE_COMPONENTS.md) | HTMLComponentsV2 with Svelte 5 |
|
|
231
|
+
| [API Reference](./docs/API_REFERENCE.md) | Complete API documentation |
|
|
528
232
|
|
|
529
|
-
|
|
530
|
-
const dbi = require("../dbi");
|
|
531
|
-
const Discord = require("discord.js");
|
|
233
|
+
---
|
|
532
234
|
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
235
|
+
## 🏗️ Project Structure
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
my-bot/
|
|
239
|
+
├── dbi.js # DBI configuration
|
|
240
|
+
├── index.js # Bot entry point
|
|
241
|
+
├── publish.js # Command publisher
|
|
242
|
+
└── src/
|
|
243
|
+
├── commands/ # Slash commands
|
|
244
|
+
├── components/ # Buttons, modals, menus
|
|
245
|
+
├── events/ # Event handlers
|
|
246
|
+
└── locales/ # Language files
|
|
545
247
|
```
|
|
546
|
-
Button & SelectMenu & Modal hakkında çok güzel ve havalı bir özelliği sizlerle buluşturuyoruz. Artık bunların üzerinde istediğiniz değeri taşıyabilirsiniz. (Referans/Obje veya yazı/sayı gibi.) Örneğin `dbi.interaction("viewGender").toJSON("male")` bize Discord.js tarafından desteklenen geçerli bir component sunacaktır. Ve to json içerisinde sunulan değere hem `options` kısmını bir fonksiyona çevirerek ulaşabilir hem de interaksiyonun kendisi çağırıldığında ulaşabilirsiniz. Bu konuyla ilgili unutmamanız gereken bir şey var. Eğer düz yazı veya sayı taşıyacaksanız bu yazı veya sayıların toplam uzunluğu 100 karakteri geçmemeli. Çünkü bu değerler direkt olarak düğmenin üzerinde taşınmakta ve siz botu kapatıp açsanız bile orada kalacak şekilde çalışmaktadırlar.
|
|
547
248
|
|
|
548
|
-
|
|
249
|
+
---
|
|
549
250
|
|
|
550
|
-
|
|
251
|
+
## 🤝 Contributing
|
|
551
252
|
|
|
552
|
-
|
|
253
|
+
Contributions are welcome! Feel free to open issues or submit pull requests.
|
|
553
254
|
|
|
554
|
-
|
|
555
|
-
Örneğin Türk bir kullanıcıya `/cinsiyet seç` şeklinde gözüken komut yabancı bir kullanıcıya `/select gender` olarak gözükebilir. (Dilediğiniz gibi konfigüre edebilirsiniz.)
|
|
255
|
+
---
|
|
556
256
|
|
|
557
|
-
|
|
257
|
+
## 📄 License
|
|
558
258
|
|
|
559
|
-
|
|
560
|
-
const dbi = require("../dbi");
|
|
259
|
+
[GPL-3.0](LICENSE) © TheArmagan
|
|
561
260
|
|
|
562
|
-
|
|
563
|
-
InteractionLocale({
|
|
564
|
-
name: "cinsiyet seç",
|
|
565
|
-
data: {
|
|
566
|
-
en: {
|
|
567
|
-
name: "select gender",
|
|
568
|
-
description: "Allows you to select a gender.",
|
|
569
|
-
options: {
|
|
570
|
-
cinsiyet: {
|
|
571
|
-
name: "gender",
|
|
572
|
-
description: "Select your gender correctly.",
|
|
573
|
-
choices: {
|
|
574
|
-
"Erkek": "Male",
|
|
575
|
-
"Kadın": "Female",
|
|
576
|
-
"Diğer": "Other"
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
});
|
|
583
|
-
});
|
|
584
|
-
```
|
|
261
|
+
---
|
|
585
262
|
|
|
586
|
-
|
|
263
|
+
<div align="center">
|
|
587
264
|
|
|
588
|
-
|
|
265
|
+
**"There will always be something free and valuable on earth."**
|
|
589
266
|
|
|
590
|
-
|
|
267
|
+
Made with ❤️ by [TheArmagan](https://github.com/TheArmagan)
|
|
591
268
|
|
|
592
|
-
|
|
269
|
+
</div>
|