@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
@@ -1,296 +0,0 @@
1
- ================================================================================
2
- DBI - GETTING STARTED GUIDE - LLM REFERENCE DOCUMENT
3
- ================================================================================
4
-
5
- DOCUMENT TYPE: Setup & Configuration Guide
6
- PACKAGE: @mostfeatured/dbi
7
-
8
- ================================================================================
9
- SECTION 1: PREREQUISITES
10
- ================================================================================
11
-
12
- REQUIREMENT | DETAILS
13
- ---------------------------|--------------------------------------------------
14
- Node.js | Version 16.9.0 or higher
15
- Discord Application | Create at https://discord.com/developers/applications
16
- JavaScript/TypeScript | Basic knowledge required
17
-
18
- ================================================================================
19
- SECTION 2: INSTALLATION
20
- ================================================================================
21
-
22
- CREATE NEW PROJECT:
23
- mkdir my-discord-bot
24
- cd my-discord-bot
25
- npm init -y
26
-
27
- INSTALL DEPENDENCIES:
28
- npm install @mostfeatured/dbi discord.js
29
-
30
- FOR TYPESCRIPT:
31
- npm install -D typescript @types/node ts-node
32
-
33
- ================================================================================
34
- SECTION 3: PROJECT STRUCTURE
35
- ================================================================================
36
-
37
- my-discord-bot/
38
- ├── package.json
39
- ├── .env # Environment variables (SECRET!)
40
- ├── dbi.js # DBI configuration
41
- ├── login.js # Bot startup script
42
- ├── publish.js # Command publishing script
43
- └── src/
44
- ├── commands/ # Slash commands
45
- │ └── ping.js
46
- ├── components/ # Buttons, Select Menus, Modals
47
- │ └── confirm.js
48
- ├── events/ # Discord event handlers
49
- │ └── ready.js
50
- └── locales/ # Language files
51
- └── en.js
52
-
53
- ================================================================================
54
- SECTION 4: DBI CONFIGURATION (dbi.js)
55
- ================================================================================
56
-
57
- FULL CONFIGURATION EXAMPLE:
58
- ---------------------------
59
- const { createDBI } = require("@mostfeatured/dbi");
60
-
61
- const dbi = createDBI("my-bot", {
62
- strict: true,
63
-
64
- discord: {
65
- token: process.env.DISCORD_TOKEN,
66
- options: {
67
- intents: [
68
- "Guilds",
69
- "GuildMessages",
70
- "MessageContent"
71
- ]
72
- }
73
- },
74
-
75
- defaults: {
76
- locale: {
77
- name: "en",
78
- invalidPath: (ctx) => `Missing translation: ${ctx.path}`
79
- },
80
- defaultMemberPermissions: ["SendMessages"],
81
- directMessages: false
82
- },
83
-
84
- references: {
85
- autoClear: {
86
- ttl: 60 * 60 * 1000,
87
- check: 60 * 1000
88
- }
89
- },
90
-
91
- inlineListeners: {
92
- autoClear: {
93
- ttl: 15 * 60 * 1000,
94
- check: 60 * 1000
95
- }
96
- }
97
- });
98
-
99
- module.exports = dbi;
100
-
101
- CONFIGURATION OPTIONS TABLE:
102
- ----------------------------
103
- OPTION | TYPE | DESCRIPTION
104
- ---------------------------------|-------------------|----------------------------
105
- strict | boolean | Throw errors for duplicates
106
- discord.token | string | Bot token
107
- discord.options | ClientOptions | Discord.js client options
108
- defaults.locale.name | string | Default locale name
109
- defaults.locale.invalidPath | string|function | Missing locale message
110
- defaults.defaultMemberPermissions| string[] | Required permissions
111
- defaults.directMessages | boolean | Allow commands in DMs
112
- references.autoClear.ttl | number | Reference TTL (ms)
113
- references.autoClear.check | number | Cleanup interval (ms)
114
- sharding | "hybrid"|"default"|"off" | Sharding mode
115
- store | DBIStore | Custom persistent store
116
-
117
- ================================================================================
118
- SECTION 5: COMMAND EXAMPLE (src/commands/ping.js)
119
- ================================================================================
120
-
121
- const dbi = require("../../dbi");
122
-
123
- dbi.register(({ ChatInput }) => {
124
- ChatInput({
125
- name: "ping",
126
- description: "Check the bot's latency",
127
-
128
- async onExecute({ interaction, dbi }) {
129
- const ws = dbi.client().client.ws.ping;
130
- const start = Date.now();
131
-
132
- await interaction.deferReply();
133
- const roundtrip = Date.now() - start;
134
-
135
- await interaction.editReply(
136
- `Pong!\n` +
137
- `> WebSocket: ${ws}ms\n` +
138
- `> Roundtrip: ${roundtrip}ms`
139
- );
140
- }
141
- });
142
- });
143
-
144
- ================================================================================
145
- SECTION 6: EVENT HANDLER EXAMPLE (src/events/ready.js)
146
- ================================================================================
147
-
148
- const dbi = require("../../dbi");
149
-
150
- dbi.register(({ Event }) => {
151
- Event({
152
- name: "clientReady",
153
- id: "ready-handler",
154
-
155
- onExecute({ client }) {
156
- console.log(`Bot is online!`);
157
- console.log(`Serving ${client.guilds.cache.size} guilds`);
158
-
159
- client.user.setActivity({
160
- name: "with DBI",
161
- type: 0
162
- });
163
- }
164
- });
165
- });
166
-
167
- ================================================================================
168
- SECTION 7: LOGIN SCRIPT (login.js)
169
- ================================================================================
170
-
171
- const { Utils } = require("@mostfeatured/dbi");
172
- const dbi = require("./dbi");
173
-
174
- async function start() {
175
- try {
176
- await Utils.recursiveImport("./src");
177
- await dbi.load();
178
- await dbi.login();
179
- console.log(`Logged in as ${dbi.client().client.user.tag}`);
180
- } catch (error) {
181
- console.error("Failed to start bot:", error);
182
- process.exit(1);
183
- }
184
- }
185
-
186
- start();
187
-
188
- ================================================================================
189
- SECTION 8: PUBLISH SCRIPT (publish.js)
190
- ================================================================================
191
-
192
- const { Utils } = require("@mostfeatured/dbi");
193
- const dbi = require("./dbi");
194
-
195
- async function publish() {
196
- try {
197
- await Utils.recursiveImport("./src");
198
- await dbi.load();
199
-
200
- // Development (instant updates):
201
- await dbi.publish("Guild", "YOUR_GUILD_ID");
202
-
203
- // Production (up to 1 hour delay):
204
- // await dbi.publish("Global");
205
-
206
- await dbi.unload();
207
- console.log("Commands published successfully!");
208
- } catch (error) {
209
- console.error("Failed to publish commands:", error);
210
- process.exit(1);
211
- }
212
- }
213
-
214
- publish();
215
-
216
- ================================================================================
217
- SECTION 9: ENVIRONMENT VARIABLES (.env)
218
- ================================================================================
219
-
220
- CREATE .env FILE:
221
- DISCORD_TOKEN=your_bot_token_here
222
-
223
- LOAD IN dbi.js:
224
- require("dotenv").config();
225
-
226
- INSTALL DOTENV:
227
- npm install dotenv
228
-
229
- ================================================================================
230
- SECTION 10: RUNNING THE BOT
231
- ================================================================================
232
-
233
- STEP 1 - Publish commands:
234
- node publish.js
235
-
236
- STEP 2 - Start the bot:
237
- node login.js
238
-
239
- DEVELOPMENT TIP:
240
- Publish to guild instead of global for instant updates.
241
-
242
- ================================================================================
243
- SECTION 11: TYPESCRIPT SETUP
244
- ================================================================================
245
-
246
- tsconfig.json:
247
- {
248
- "compilerOptions": {
249
- "target": "ES2020",
250
- "module": "commonjs",
251
- "lib": ["ES2020"],
252
- "strict": true,
253
- "esModuleInterop": true,
254
- "skipLibCheck": true,
255
- "forceConsistentCasingInFileNames": true,
256
- "outDir": "./dist",
257
- "rootDir": "./src",
258
- "declaration": true
259
- },
260
- "include": ["src/**/*"],
261
- "exclude": ["node_modules"]
262
- }
263
-
264
- ================================================================================
265
- SECTION 12: TROUBLESHOOTING
266
- ================================================================================
267
-
268
- PROBLEM: Commands not appearing
269
- SOLUTIONS:
270
- 1. Run publish.js
271
- 2. Wait up to 1 hour for global commands
272
- 3. Check bot has applications.commands scope
273
- 4. Verify bot is in the guild
274
-
275
- PROBLEM: Bot not responding
276
- SOLUTIONS:
277
- 1. Check bot permissions
278
- 2. Verify intents are configured
279
- 3. Check console for errors
280
- 4. Ensure dbi.load() before dbi.login()
281
-
282
- PROBLEM: "Missing Access" error
283
- SOLUTIONS:
284
- 1. Invite bot with proper permissions
285
- 2. Check channel permissions
286
- 3. Verify bot role position
287
-
288
- PROBLEM: Token errors
289
- SOLUTIONS:
290
- 1. Regenerate token in Discord Developer Portal
291
- 2. Check .env file is loading
292
- 3. No spaces around = in .env
293
-
294
- ================================================================================
295
- END OF DOCUMENT
296
- ================================================================================