@mostfeatured/dbi 0.2.17 → 0.2.18

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 (77) hide show
  1. package/dist/src/types/Event.d.ts +21 -13
  2. package/dist/src/types/Event.d.ts.map +1 -1
  3. package/dist/src/types/Event.js.map +1 -1
  4. package/dist/test/index.js +1 -1
  5. package/dist/test/index.js.map +1 -1
  6. package/generated/namespaceData.d.ts +3 -1
  7. package/package.json +6 -2
  8. package/.gitattributes +0 -2
  9. package/.hintrc +0 -8
  10. package/.vscode/settings.json +0 -3
  11. package/docs/ADVANCED_FEATURES.md +0 -840
  12. package/docs/API_REFERENCE.md +0 -929
  13. package/docs/CHAT_INPUT.md +0 -811
  14. package/docs/COMPONENTS.md +0 -1039
  15. package/docs/EVENTS.md +0 -568
  16. package/docs/GETTING_STARTED.md +0 -398
  17. package/docs/LOCALIZATION.md +0 -777
  18. package/docs/README.md +0 -345
  19. package/docs/SVELTE_COMPONENTS.md +0 -1111
  20. package/docs/llm/ADVANCED_FEATURES.txt +0 -521
  21. package/docs/llm/API_REFERENCE.txt +0 -659
  22. package/docs/llm/CHAT_INPUT.txt +0 -514
  23. package/docs/llm/COMPONENTS.txt +0 -595
  24. package/docs/llm/EVENTS.txt +0 -449
  25. package/docs/llm/GETTING_STARTED.txt +0 -296
  26. package/docs/llm/LOCALIZATION.txt +0 -501
  27. package/docs/llm/README.txt +0 -193
  28. package/docs/llm/SVELTE_COMPONENTS.txt +0 -566
  29. package/src/DBI.ts +0 -1007
  30. package/src/Events.ts +0 -189
  31. package/src/data/eventMap.json +0 -248
  32. package/src/index.ts +0 -23
  33. package/src/methods/handleMessageCommands.ts +0 -482
  34. package/src/methods/hookEventListeners.ts +0 -119
  35. package/src/methods/hookInteractionListeners.ts +0 -314
  36. package/src/methods/publishInteractions.ts +0 -256
  37. package/src/types/ApplicationRoleConnectionMetadata.ts +0 -19
  38. package/src/types/Builders/ButtonBuilder.ts +0 -53
  39. package/src/types/Builders/ChannelSelectMenuBuilder.ts +0 -53
  40. package/src/types/Builders/MentionableSelectMenuBuilder.ts +0 -53
  41. package/src/types/Builders/ModalBuilder.ts +0 -53
  42. package/src/types/Builders/RoleSelectMenuBuilder.ts +0 -53
  43. package/src/types/Builders/StringSelectMenuBuilder.ts +0 -53
  44. package/src/types/Builders/UserSelectMenuBuilder.ts +0 -53
  45. package/src/types/ChatInput/ChatInput.ts +0 -28
  46. package/src/types/ChatInput/ChatInputOptions.ts +0 -388
  47. package/src/types/Components/Button.ts +0 -39
  48. package/src/types/Components/ChannelSelectMenu.ts +0 -43
  49. package/src/types/Components/HTMLComponentsV2/HTMLComponentsV2Handlers.ts +0 -78
  50. package/src/types/Components/HTMLComponentsV2/index.ts +0 -800
  51. package/src/types/Components/HTMLComponentsV2/parser.ts +0 -649
  52. package/src/types/Components/HTMLComponentsV2/svelteParser.ts +0 -1503
  53. package/src/types/Components/HTMLComponentsV2/svelteRenderer.ts +0 -416
  54. package/src/types/Components/MentionableSelectMenu.ts +0 -43
  55. package/src/types/Components/Modal.ts +0 -46
  56. package/src/types/Components/RoleSelectMenu.ts +0 -43
  57. package/src/types/Components/StringSelectMenu.ts +0 -43
  58. package/src/types/Components/UserSelectMenu.ts +0 -43
  59. package/src/types/Event.ts +0 -145
  60. package/src/types/Interaction.ts +0 -100
  61. package/src/types/other/CustomEvent.ts +0 -19
  62. package/src/types/other/FakeMessageInteraction.ts +0 -408
  63. package/src/types/other/InteractionLocale.ts +0 -34
  64. package/src/types/other/Locale.ts +0 -70
  65. package/src/types/other/MessageContextMenu.ts +0 -27
  66. package/src/types/other/UserContextMenu.ts +0 -25
  67. package/src/utils/MemoryStore.ts +0 -28
  68. package/src/utils/UtilTypes.ts +0 -11
  69. package/src/utils/customId.ts +0 -49
  70. package/src/utils/permissions.ts +0 -5
  71. package/src/utils/recursiveImport.ts +0 -35
  72. package/src/utils/recursiveUnload.ts +0 -25
  73. package/src/utils/unloadModule.ts +0 -7
  74. package/test/index.ts +0 -176
  75. package/test/product-showcase.svelte +0 -558
  76. package/test/test.ts +0 -3
  77. package/tsconfig.json +0 -51
package/docs/README.md DELETED
@@ -1,345 +0,0 @@
1
- # DBI - Discord Bot Infrastructure
2
-
3
- <div align="center">
4
-
5
- **The most advanced, modern, and developer-friendly Discord bot framework available.**
6
-
7
- [![npm version](https://img.shields.io/npm/v/@mostfeatured/dbi.svg)](https://www.npmjs.com/package/@mostfeatured/dbi)
8
- [![Discord.js](https://img.shields.io/badge/discord.js-v14-blue.svg)](https://discord.js.org)
9
- [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg)](https://www.typescriptlang.org/)
10
-
11
- </div>
12
-
13
- ---
14
-
15
- ## 🌟 Why DBI?
16
-
17
- DBI (Discord Bot Infrastructure) is not just another Discord bot template—it's a **powerful NPM module** that provides a complete infrastructure for building production-ready Discord bots with minimal boilerplate.
18
-
19
- ### Key Features
20
-
21
- | Feature | Description |
22
- |---------|-------------|
23
- | 🎯 **Slash Commands** | Full support for Discord's application commands with type-safe options |
24
- | 🧩 **Components V2** | Buttons, Select Menus, Modals with built-in state management |
25
- | ⚡ **Svelte Integration** | Build reactive Discord UIs with Svelte 5 components |
26
- | 🌍 **Localization** | Multi-language support for both content and interactions |
27
- | 📨 **Message Commands** | Automatic slash-to-message command conversion |
28
- | 🔄 **Reference System** | Pass complex data through components without database |
29
- | ⏱️ **Rate Limiting** | Built-in per-user, channel, guild rate limiting |
30
- | 🔀 **Multi-Client** | Support for multiple bot clients simultaneously |
31
- | 📦 **Hybrid Sharding** | Built-in support for discord-hybrid-sharding |
32
- | 🔒 **Type Safety** | Full TypeScript support with intelligent autocomplete |
33
-
34
- ---
35
-
36
- ## 📚 Documentation
37
-
38
- | Document | Description |
39
- |----------|-------------|
40
- | [Getting Started](./GETTING_STARTED.md) | Installation and basic setup |
41
- | [Chat Input Commands](./CHAT_INPUT.md) | Slash commands and options |
42
- | [Components](./COMPONENTS.md) | Buttons, Select Menus, Modals |
43
- | [Events](./EVENTS.md) | Discord events and Custom Events |
44
- | [Localization](./LOCALIZATION.md) | Multi-language support |
45
- | [Svelte Components](./SVELTE_COMPONENTS.md) | Reactive UI with Svelte 5 |
46
- | [Advanced Features](./ADVANCED_FEATURES.md) | References, Rate Limiting, Message Commands |
47
- | [API Reference](./API_REFERENCE.md) | Complete API documentation |
48
-
49
- ---
50
-
51
- ## 🚀 Quick Start
52
-
53
- ### Installation
54
-
55
- ```bash
56
- npm install @mostfeatured/dbi discord.js
57
- # or
58
- pnpm add @mostfeatured/dbi discord.js
59
- # or
60
- yarn add @mostfeatured/dbi discord.js
61
- ```
62
-
63
- ### Project Structure
64
-
65
- ```
66
- my-bot/
67
- ├── dbi.js # DBI configuration
68
- ├── login.js # Bot startup script
69
- ├── publish.js # Command publishing script
70
- └── src/ # Your bot features
71
- ├── commands/
72
- ├── events/
73
- ├── components/
74
- └── locales/
75
- ```
76
-
77
- ### Step 1: Configure DBI (`dbi.js`)
78
-
79
- ```javascript
80
- const { createDBI } = require("@mostfeatured/dbi");
81
-
82
- const dbi = createDBI("my-bot", {
83
- strict: true,
84
- discord: {
85
- token: process.env.DISCORD_TOKEN,
86
- options: {
87
- intents: ["Guilds", "GuildMessages"]
88
- }
89
- },
90
- defaults: {
91
- locale: { name: "en" },
92
- defaultMemberPermissions: ["SendMessages"],
93
- directMessages: false
94
- },
95
- references: {
96
- autoClear: {
97
- ttl: 60 * 60 * 1000, // 1 hour
98
- check: 60 * 1000 // Check every minute
99
- }
100
- }
101
- });
102
-
103
- module.exports = dbi;
104
- ```
105
-
106
- ### Step 2: Create a Command (`src/commands/ping.js`)
107
-
108
- ```javascript
109
- const dbi = require("../dbi");
110
-
111
- dbi.register(({ ChatInput }) => {
112
- ChatInput({
113
- name: "ping",
114
- description: "Check the bot's latency",
115
- async onExecute({ interaction, dbi }) {
116
- const latency = dbi.client().client.ws.ping;
117
- await interaction.reply(`🏓 Pong! Latency: ${latency}ms`);
118
- }
119
- });
120
- });
121
- ```
122
-
123
- ### Step 3: Start the Bot (`login.js`)
124
-
125
- ```javascript
126
- const { Utils } = require("@mostfeatured/dbi");
127
- const dbi = require("./dbi");
128
-
129
- (async () => {
130
- // Import all files from src/
131
- await Utils.recursiveImport("./src");
132
-
133
- // Load all registered features
134
- await dbi.load();
135
-
136
- // Connect to Discord
137
- await dbi.login();
138
-
139
- console.log(`✅ Logged in as ${dbi.client().client.user.tag}`);
140
- })();
141
- ```
142
-
143
- ### Step 4: Publish Commands (`publish.js`)
144
-
145
- ```javascript
146
- const { Utils } = require("@mostfeatured/dbi");
147
- const dbi = require("./dbi");
148
-
149
- (async () => {
150
- await Utils.recursiveImport("./src");
151
- await dbi.load();
152
-
153
- // Publish to a specific guild (for development)
154
- await dbi.publish("Guild", "YOUR_GUILD_ID");
155
-
156
- // Or publish globally (for production)
157
- // await dbi.publish("Global");
158
-
159
- await dbi.unload();
160
- console.log("✅ Commands published!");
161
- })();
162
- ```
163
-
164
- ---
165
-
166
- ## 🎯 Core Concepts
167
-
168
- ### The Register Pattern
169
-
170
- DBI uses a register pattern to define all bot features:
171
-
172
- ```javascript
173
- dbi.register(({ ChatInput, Button, Event, Locale }) => {
174
- // Define features here
175
- ChatInput({ /* ... */ });
176
- Button({ /* ... */ });
177
- Event({ /* ... */ });
178
- Locale({ /* ... */ });
179
- });
180
- ```
181
-
182
- This pattern provides:
183
- - **Dependency injection** - Access only what you need
184
- - **Type safety** - Full autocomplete support
185
- - **Organization** - Group related features together
186
- - **Hot reloading** - Support for `onUnload` callbacks
187
-
188
- ### Available Register Functions
189
-
190
- | Function | Description |
191
- |----------|-------------|
192
- | `ChatInput` | Slash commands |
193
- | `Button` | Button components |
194
- | `StringSelectMenu` | String select menus |
195
- | `UserSelectMenu` | User select menus |
196
- | `RoleSelectMenu` | Role select menus |
197
- | `ChannelSelectMenu` | Channel select menus |
198
- | `MentionableSelectMenu` | Mentionable select menus |
199
- | `Modal` | Modal dialogs |
200
- | `MessageContextMenu` | Message context menu commands |
201
- | `UserContextMenu` | User context menu commands |
202
- | `Event` | Discord events |
203
- | `Locale` | Content localization |
204
- | `InteractionLocale` | Interaction name localization |
205
- | `CustomEvent` | Custom event definitions |
206
- | `HTMLComponentsV2` | Svelte/Eta template components |
207
- | `ChatInputOptions` | Command option builders |
208
- | `onUnload` | Cleanup callback for hot reloading |
209
-
210
- ### Inline Listeners
211
-
212
- Create one-time use components without pre-registration:
213
-
214
- ```javascript
215
- dbi.register(({ ChatInput, createInlineButton }) => {
216
- ChatInput({
217
- name: "confirm",
218
- description: "Confirm an action",
219
- async onExecute({ interaction }) {
220
- const confirmBtn = createInlineButton({
221
- options: { style: "Success", label: "Confirm" },
222
- onExecute({ interaction }) {
223
- interaction.reply("Confirmed!");
224
- }
225
- });
226
-
227
- await interaction.reply({
228
- content: "Are you sure?",
229
- components: [
230
- {
231
- type: 1,
232
- components: [confirmBtn.toJSON()]
233
- }
234
- ]
235
- });
236
- }
237
- });
238
- });
239
- ```
240
-
241
- ---
242
-
243
- ## 💡 Example: Complete Feature
244
-
245
- Here's a complete example showing multiple DBI features working together:
246
-
247
- ```javascript
248
- const dbi = require("../dbi");
249
- const Discord = require("discord.js");
250
-
251
- dbi.register(({ ChatInput, ChatInputOptions, Button, Locale }) => {
252
-
253
- // Localization
254
- Locale({
255
- name: "en",
256
- data: {
257
- poll: {
258
- title: "Poll: {0}",
259
- voted: "You voted for: {0}",
260
- results: "Results so far:"
261
- }
262
- }
263
- });
264
-
265
- // Button handler
266
- Button({
267
- name: "poll-vote",
268
- onExecute({ interaction, data, locale }) {
269
- const [option] = data;
270
- interaction.reply({
271
- content: locale.user.data.poll.voted(option),
272
- ephemeral: true
273
- });
274
- },
275
- options: {
276
- style: Discord.ButtonStyle.Primary
277
- }
278
- });
279
-
280
- // Slash command
281
- ChatInput({
282
- name: "poll",
283
- description: "Create a poll",
284
- options: [
285
- ChatInputOptions.string({
286
- name: "question",
287
- description: "The poll question",
288
- required: true
289
- }),
290
- ChatInputOptions.string({
291
- name: "options",
292
- description: "Comma-separated options",
293
- required: true
294
- })
295
- ],
296
- async onExecute({ interaction, locale, dbi }) {
297
- const question = interaction.options.getString("question");
298
- const options = interaction.options.getString("options").split(",");
299
-
300
- const buttons = options.map(opt =>
301
- dbi.interaction("poll-vote").toJSON({
302
- overrides: { label: opt.trim() },
303
- reference: { data: [opt.trim()] }
304
- })
305
- );
306
-
307
- await interaction.reply({
308
- content: locale.user.data.poll.title(question),
309
- components: [
310
- {
311
- type: Discord.ComponentType.ActionRow,
312
- components: buttons
313
- }
314
- ]
315
- });
316
- }
317
- });
318
- });
319
- ```
320
-
321
- ---
322
-
323
- ## 🔗 Related Links
324
-
325
- - [Discord.js Documentation](https://discord.js.org/)
326
- - [Discord Developer Portal](https://discord.com/developers/applications)
327
- - [Discord API Documentation](https://discord.com/developers/docs)
328
-
329
- ---
330
-
331
- ## 📄 License
332
-
333
- GPL-3.0 License - See [LICENSE](../LICENSE) for details.
334
-
335
- ---
336
-
337
- <div align="center">
338
-
339
- **Made with ❤️ by [TheArmagan](https://github.com/TheArmagan) and the MostFeatured team**
340
-
341
- </div>
342
-
343
- ---
344
-
345
- > 📄 **LLM-optimized version:** [llm/README.txt](./llm/README.txt)