@mostfeatured/dbi 0.2.13 → 0.2.15
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/types/Components/HTMLComponentsV2/index.d.ts +33 -1
- package/dist/src/types/Components/HTMLComponentsV2/index.d.ts.map +1 -1
- package/dist/src/types/Components/HTMLComponentsV2/index.js +408 -82
- package/dist/src/types/Components/HTMLComponentsV2/index.js.map +1 -1
- package/dist/src/types/Components/HTMLComponentsV2/parser.d.ts +52 -0
- package/dist/src/types/Components/HTMLComponentsV2/parser.d.ts.map +1 -1
- package/dist/src/types/Components/HTMLComponentsV2/parser.js +275 -0
- package/dist/src/types/Components/HTMLComponentsV2/parser.js.map +1 -1
- package/dist/src/types/Components/HTMLComponentsV2/svelteParser.d.ts +26 -0
- package/dist/src/types/Components/HTMLComponentsV2/svelteParser.d.ts.map +1 -1
- package/dist/src/types/Components/HTMLComponentsV2/svelteParser.js +509 -34
- package/dist/src/types/Components/HTMLComponentsV2/svelteParser.js.map +1 -1
- package/dist/src/types/Components/HTMLComponentsV2/svelteRenderer.d.ts +10 -0
- package/dist/src/types/Components/HTMLComponentsV2/svelteRenderer.d.ts.map +1 -1
- package/dist/src/types/Components/HTMLComponentsV2/svelteRenderer.js +76 -11
- package/dist/src/types/Components/HTMLComponentsV2/svelteRenderer.js.map +1 -1
- package/dist/test/index.js +76 -3
- package/dist/test/index.js.map +1 -1
- package/docs/ADVANCED_FEATURES.md +4 -0
- package/docs/API_REFERENCE.md +4 -0
- package/docs/CHAT_INPUT.md +4 -0
- package/docs/COMPONENTS.md +4 -0
- package/docs/EVENTS.md +4 -0
- package/docs/GETTING_STARTED.md +4 -0
- package/docs/LOCALIZATION.md +4 -0
- package/docs/README.md +4 -0
- package/docs/SVELTE_COMPONENTS.md +162 -6
- package/docs/llm/ADVANCED_FEATURES.txt +521 -0
- package/docs/llm/API_REFERENCE.txt +659 -0
- package/docs/llm/CHAT_INPUT.txt +514 -0
- package/docs/llm/COMPONENTS.txt +595 -0
- package/docs/llm/EVENTS.txt +449 -0
- package/docs/llm/GETTING_STARTED.txt +296 -0
- package/docs/llm/LOCALIZATION.txt +501 -0
- package/docs/llm/README.txt +193 -0
- package/docs/llm/SVELTE_COMPONENTS.txt +566 -0
- package/generated/svelte-dbi.d.ts +122 -0
- package/package.json +1 -1
- package/src/types/Components/HTMLComponentsV2/index.ts +466 -94
- package/src/types/Components/HTMLComponentsV2/parser.ts +317 -0
- package/src/types/Components/HTMLComponentsV2/svelteParser.ts +567 -35
- package/src/types/Components/HTMLComponentsV2/svelteRenderer.ts +91 -13
- package/test/index.ts +76 -3
- package/test/product-showcase.svelte +380 -24
- package/llm.txt +0 -1088
|
@@ -0,0 +1,296 @@
|
|
|
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
|
+
================================================================================
|