@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,659 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
DBI - API REFERENCE - LLM REFERENCE DOCUMENT
|
|
3
|
+
================================================================================
|
|
4
|
+
|
|
5
|
+
DOCUMENT TYPE: Complete API Documentation
|
|
6
|
+
PACKAGE: @mostfeatured/dbi
|
|
7
|
+
|
|
8
|
+
================================================================================
|
|
9
|
+
SECTION 1: createDBI FUNCTION
|
|
10
|
+
================================================================================
|
|
11
|
+
|
|
12
|
+
SIGNATURE:
|
|
13
|
+
----------
|
|
14
|
+
function createDBI<TNamespace, TOtherType>(
|
|
15
|
+
namespace: TNamespace,
|
|
16
|
+
config: DBIConfigConstructor<TNamespace, TOtherType>
|
|
17
|
+
): DBI<TNamespace, TOtherType>
|
|
18
|
+
|
|
19
|
+
PARAMETERS:
|
|
20
|
+
-----------
|
|
21
|
+
PARAMETER | TYPE | DESCRIPTION
|
|
22
|
+
----------|----------------------|---------------------------
|
|
23
|
+
namespace | string | Unique identifier for bot
|
|
24
|
+
config | DBIConfigConstructor | Configuration object
|
|
25
|
+
|
|
26
|
+
================================================================================
|
|
27
|
+
SECTION 2: CONFIG OPTIONS
|
|
28
|
+
================================================================================
|
|
29
|
+
|
|
30
|
+
interface DBIConfigConstructor {
|
|
31
|
+
discord: {
|
|
32
|
+
token: string;
|
|
33
|
+
options: Discord.ClientOptions;
|
|
34
|
+
} | Array<{
|
|
35
|
+
namespace: string;
|
|
36
|
+
token: string;
|
|
37
|
+
options: Discord.ClientOptions;
|
|
38
|
+
}>;
|
|
39
|
+
|
|
40
|
+
defaults?: {
|
|
41
|
+
locale?: {
|
|
42
|
+
name?: string;
|
|
43
|
+
invalidPath?: string | ((ctx) => string);
|
|
44
|
+
};
|
|
45
|
+
directMessages?: boolean;
|
|
46
|
+
defaultMemberPermissions?: Discord.PermissionsString[];
|
|
47
|
+
messageCommands?: {
|
|
48
|
+
deferReplyContent?: string | ((ctx) => string | Promise<string>);
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
sharding?: "hybrid" | "default" | "off";
|
|
53
|
+
store?: DBIStore;
|
|
54
|
+
|
|
55
|
+
references?: {
|
|
56
|
+
autoClear?: {
|
|
57
|
+
check: number;
|
|
58
|
+
ttl: number;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
inlineListeners?: {
|
|
63
|
+
autoClear?: {
|
|
64
|
+
check: number;
|
|
65
|
+
ttl: number;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
data?: {
|
|
70
|
+
other?: Record<string, any>;
|
|
71
|
+
refs?: Map<string, { at: number; value: any; ttl?: number }>;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
strict?: boolean;
|
|
75
|
+
|
|
76
|
+
messageCommands?: {
|
|
77
|
+
prefixes: string[] | ((ctx) => string[] | Promise<string[]>);
|
|
78
|
+
typeAliases?: {
|
|
79
|
+
booleans?: Record<string, boolean>;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
================================================================================
|
|
85
|
+
SECTION 3: DBI CLASS PROPERTIES
|
|
86
|
+
================================================================================
|
|
87
|
+
|
|
88
|
+
PROPERTY | TYPE | DESCRIPTION
|
|
89
|
+
-----------------|----------------------|---------------------------
|
|
90
|
+
namespace | string | Bot namespace
|
|
91
|
+
config | DBIConfig | Configuration object
|
|
92
|
+
data | DBIData | Data storage
|
|
93
|
+
events | Events | Event system
|
|
94
|
+
cluster | ClusterClient? | Hybrid sharding cluster
|
|
95
|
+
loaded | boolean | Whether DBI is loaded
|
|
96
|
+
|
|
97
|
+
DATA OBJECT:
|
|
98
|
+
------------
|
|
99
|
+
interface DBIData {
|
|
100
|
+
interactions: Discord.Collection<string, TDBIInteractions>;
|
|
101
|
+
events: Discord.Collection<string, DBIEvent>;
|
|
102
|
+
locales: Discord.Collection<string, DBILocale>;
|
|
103
|
+
interactionLocales: Discord.Collection<string, DBIInteractionLocale>;
|
|
104
|
+
other: Record<string, any>;
|
|
105
|
+
eventMap: Record<string, string[]>;
|
|
106
|
+
customEventNames: Set<string>;
|
|
107
|
+
unloaders: Set<() => void>;
|
|
108
|
+
registers: Set<Function>;
|
|
109
|
+
registerUnloaders: Set<Function>;
|
|
110
|
+
refs: Map<string, { at: number; value: any; ttl?: number }>;
|
|
111
|
+
clients: ClientsArray;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
================================================================================
|
|
115
|
+
SECTION 4: DBI CLASS METHODS
|
|
116
|
+
================================================================================
|
|
117
|
+
|
|
118
|
+
register(callback):
|
|
119
|
+
-------------------
|
|
120
|
+
async register(
|
|
121
|
+
callback: (api: DBIRegisterAPI) => void | Promise<void>
|
|
122
|
+
): Promise<void>
|
|
123
|
+
|
|
124
|
+
load(...flags):
|
|
125
|
+
---------------
|
|
126
|
+
async load(...flags: string[]): Promise<boolean>
|
|
127
|
+
|
|
128
|
+
unload():
|
|
129
|
+
---------
|
|
130
|
+
async unload(): Promise<boolean>
|
|
131
|
+
|
|
132
|
+
login():
|
|
133
|
+
--------
|
|
134
|
+
async login(): Promise<void>
|
|
135
|
+
|
|
136
|
+
publish(type, guildId?, clear?):
|
|
137
|
+
--------------------------------
|
|
138
|
+
async publish(type: "Global", clear?: boolean): Promise<void>
|
|
139
|
+
async publish(type: "Guild", guildId: string, clear?: boolean): Promise<void>
|
|
140
|
+
|
|
141
|
+
interaction(name):
|
|
142
|
+
------------------
|
|
143
|
+
interaction<T>(name: T): TDBIInteractions
|
|
144
|
+
|
|
145
|
+
event(name):
|
|
146
|
+
------------
|
|
147
|
+
event(name: string): DBIEvent
|
|
148
|
+
|
|
149
|
+
locale(name):
|
|
150
|
+
-------------
|
|
151
|
+
locale(name: string): DBILocale
|
|
152
|
+
|
|
153
|
+
client(namespace?):
|
|
154
|
+
-------------------
|
|
155
|
+
client(namespace?: string): TDBIClientData
|
|
156
|
+
|
|
157
|
+
emit(name, args):
|
|
158
|
+
-----------------
|
|
159
|
+
emit(name: string, args: object): void
|
|
160
|
+
|
|
161
|
+
get(key, defaultValue?):
|
|
162
|
+
------------------------
|
|
163
|
+
get<K>(key: K, defaultValue?: any): any
|
|
164
|
+
|
|
165
|
+
set(key, value):
|
|
166
|
+
----------------
|
|
167
|
+
set<K>(key: K, value: any): void
|
|
168
|
+
|
|
169
|
+
has(key):
|
|
170
|
+
---------
|
|
171
|
+
has(key: string): boolean
|
|
172
|
+
|
|
173
|
+
delete(key):
|
|
174
|
+
------------
|
|
175
|
+
delete(key: string): boolean
|
|
176
|
+
|
|
177
|
+
================================================================================
|
|
178
|
+
SECTION 5: REGISTER API - CHATINPUT
|
|
179
|
+
================================================================================
|
|
180
|
+
|
|
181
|
+
ChatInput(config: {
|
|
182
|
+
name: string;
|
|
183
|
+
description: string;
|
|
184
|
+
options?: any[];
|
|
185
|
+
directMessages?: boolean;
|
|
186
|
+
defaultMemberPermissions?: Discord.PermissionsString[];
|
|
187
|
+
rateLimits?: DBIRateLimit[];
|
|
188
|
+
flag?: string;
|
|
189
|
+
publish?: string;
|
|
190
|
+
other?: {
|
|
191
|
+
messageCommand?: {
|
|
192
|
+
aliases?: string[];
|
|
193
|
+
ignore?: boolean;
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
onExecute: (ctx: IDBIChatInputExecuteCtx) => void | Promise<void>;
|
|
197
|
+
}): DBIChatInput
|
|
198
|
+
|
|
199
|
+
================================================================================
|
|
200
|
+
SECTION 6: REGISTER API - CHATINPUTOPTIONS
|
|
201
|
+
================================================================================
|
|
202
|
+
|
|
203
|
+
class ChatInputOptions {
|
|
204
|
+
string(config): ApplicationCommandOption
|
|
205
|
+
stringChoices(config): ApplicationCommandOption
|
|
206
|
+
stringAutocomplete(config): ApplicationCommandOption
|
|
207
|
+
integer(config): ApplicationCommandOption
|
|
208
|
+
integerChoices(config): ApplicationCommandOption
|
|
209
|
+
integerAutocomplete(config): ApplicationCommandOption
|
|
210
|
+
number(config): ApplicationCommandOption
|
|
211
|
+
numberChoices(config): ApplicationCommandOption
|
|
212
|
+
numberAutocomplete(config): ApplicationCommandOption
|
|
213
|
+
boolean(config): ApplicationCommandOption
|
|
214
|
+
user(config): ApplicationCommandOption
|
|
215
|
+
channel(config): ApplicationCommandOption
|
|
216
|
+
role(config): ApplicationCommandOption
|
|
217
|
+
mentionable(config): ApplicationCommandOption
|
|
218
|
+
attachment(config): ApplicationCommandOption
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
================================================================================
|
|
222
|
+
SECTION 7: REGISTER API - BUTTON
|
|
223
|
+
================================================================================
|
|
224
|
+
|
|
225
|
+
Button(config: {
|
|
226
|
+
name: string;
|
|
227
|
+
options?: {
|
|
228
|
+
style: Discord.ButtonStyle;
|
|
229
|
+
label?: string;
|
|
230
|
+
emoji?: string;
|
|
231
|
+
disabled?: boolean;
|
|
232
|
+
url?: string;
|
|
233
|
+
};
|
|
234
|
+
rateLimits?: DBIRateLimit[];
|
|
235
|
+
flag?: string;
|
|
236
|
+
ttl?: number;
|
|
237
|
+
onExecute: (ctx: IDBIButtonExecuteCtx) => void | Promise<void>;
|
|
238
|
+
}): DBIButton
|
|
239
|
+
|
|
240
|
+
================================================================================
|
|
241
|
+
SECTION 8: REGISTER API - SELECT MENUS
|
|
242
|
+
================================================================================
|
|
243
|
+
|
|
244
|
+
StringSelectMenu(config: {
|
|
245
|
+
name: string;
|
|
246
|
+
options?: {
|
|
247
|
+
placeholder?: string;
|
|
248
|
+
minValues?: number;
|
|
249
|
+
maxValues?: number;
|
|
250
|
+
disabled?: boolean;
|
|
251
|
+
options: Array<{
|
|
252
|
+
label: string;
|
|
253
|
+
value: string;
|
|
254
|
+
description?: string;
|
|
255
|
+
emoji?: string;
|
|
256
|
+
default?: boolean;
|
|
257
|
+
}>;
|
|
258
|
+
};
|
|
259
|
+
rateLimits?: DBIRateLimit[];
|
|
260
|
+
flag?: string;
|
|
261
|
+
ttl?: number;
|
|
262
|
+
onExecute: (ctx) => void | Promise<void>;
|
|
263
|
+
}): DBIStringSelectMenu
|
|
264
|
+
|
|
265
|
+
UserSelectMenu, RoleSelectMenu, ChannelSelectMenu, MentionableSelectMenu:
|
|
266
|
+
Similar to StringSelectMenu but for user/role/channel/mentionable selection.
|
|
267
|
+
|
|
268
|
+
================================================================================
|
|
269
|
+
SECTION 9: REGISTER API - MODAL
|
|
270
|
+
================================================================================
|
|
271
|
+
|
|
272
|
+
Modal(config: {
|
|
273
|
+
name: string;
|
|
274
|
+
options?: {
|
|
275
|
+
title: string;
|
|
276
|
+
components: Discord.ActionRowData<Discord.ModalActionRowComponentData>[];
|
|
277
|
+
};
|
|
278
|
+
rateLimits?: DBIRateLimit[];
|
|
279
|
+
flag?: string;
|
|
280
|
+
ttl?: number;
|
|
281
|
+
onExecute: (ctx: IDBIModalExecuteCtx) => void | Promise<void>;
|
|
282
|
+
}): DBIModal
|
|
283
|
+
|
|
284
|
+
================================================================================
|
|
285
|
+
SECTION 10: REGISTER API - CONTEXT MENUS
|
|
286
|
+
================================================================================
|
|
287
|
+
|
|
288
|
+
MessageContextMenu(config: {
|
|
289
|
+
name: string;
|
|
290
|
+
directMessages?: boolean;
|
|
291
|
+
defaultMemberPermissions?: Discord.PermissionsString[];
|
|
292
|
+
rateLimits?: DBIRateLimit[];
|
|
293
|
+
flag?: string;
|
|
294
|
+
publish?: string;
|
|
295
|
+
onExecute: (ctx) => void | Promise<void>;
|
|
296
|
+
}): DBIMessageContextMenu
|
|
297
|
+
|
|
298
|
+
UserContextMenu(config: {
|
|
299
|
+
name: string;
|
|
300
|
+
directMessages?: boolean;
|
|
301
|
+
defaultMemberPermissions?: Discord.PermissionsString[];
|
|
302
|
+
rateLimits?: DBIRateLimit[];
|
|
303
|
+
flag?: string;
|
|
304
|
+
publish?: string;
|
|
305
|
+
onExecute: (ctx) => void | Promise<void>;
|
|
306
|
+
}): DBIUserContextMenu
|
|
307
|
+
|
|
308
|
+
================================================================================
|
|
309
|
+
SECTION 11: REGISTER API - EVENT
|
|
310
|
+
================================================================================
|
|
311
|
+
|
|
312
|
+
Event(config: {
|
|
313
|
+
name: keyof ClientEvents;
|
|
314
|
+
id?: string;
|
|
315
|
+
disabled?: boolean;
|
|
316
|
+
triggerType?: "OneByOne" | "OneByOneGlobal" | "Random" | "First";
|
|
317
|
+
ordered?: {
|
|
318
|
+
await?: boolean;
|
|
319
|
+
delayBefore?: number;
|
|
320
|
+
delayAfter?: number;
|
|
321
|
+
};
|
|
322
|
+
flag?: string;
|
|
323
|
+
ttl?: number;
|
|
324
|
+
onExecute: (ctx) => void | Promise<void>;
|
|
325
|
+
}): DBIEvent
|
|
326
|
+
|
|
327
|
+
================================================================================
|
|
328
|
+
SECTION 12: REGISTER API - LOCALE
|
|
329
|
+
================================================================================
|
|
330
|
+
|
|
331
|
+
Locale(config: {
|
|
332
|
+
name: TDBILocaleString;
|
|
333
|
+
data: Record<string, any>;
|
|
334
|
+
flag?: string;
|
|
335
|
+
}): DBILocale
|
|
336
|
+
|
|
337
|
+
InteractionLocale(config: {
|
|
338
|
+
name: string;
|
|
339
|
+
data: Record<string, {
|
|
340
|
+
name: string;
|
|
341
|
+
description: string;
|
|
342
|
+
options?: Record<string, {
|
|
343
|
+
name: string;
|
|
344
|
+
description: string;
|
|
345
|
+
choices?: Record<string, string>;
|
|
346
|
+
}>;
|
|
347
|
+
}>;
|
|
348
|
+
flag?: string;
|
|
349
|
+
}): DBIInteractionLocale
|
|
350
|
+
|
|
351
|
+
================================================================================
|
|
352
|
+
SECTION 13: REGISTER API - CUSTOM EVENT
|
|
353
|
+
================================================================================
|
|
354
|
+
|
|
355
|
+
CustomEvent(config: {
|
|
356
|
+
name: string;
|
|
357
|
+
map: Record<string, string>;
|
|
358
|
+
}): DBICustomEvent
|
|
359
|
+
|
|
360
|
+
================================================================================
|
|
361
|
+
SECTION 14: REGISTER API - HTMLCOMPONENTSV2
|
|
362
|
+
================================================================================
|
|
363
|
+
|
|
364
|
+
HTMLComponentsV2(config: {
|
|
365
|
+
name: string;
|
|
366
|
+
mode?: "svelte" | "eta";
|
|
367
|
+
template?: string;
|
|
368
|
+
file?: string;
|
|
369
|
+
handlers?: any[];
|
|
370
|
+
rateLimits?: DBIRateLimit[];
|
|
371
|
+
flag?: string;
|
|
372
|
+
onExecute?: (ctx) => void;
|
|
373
|
+
}): DBIHTMLComponentsV2
|
|
374
|
+
|
|
375
|
+
================================================================================
|
|
376
|
+
SECTION 15: INLINE CREATORS
|
|
377
|
+
================================================================================
|
|
378
|
+
|
|
379
|
+
createInlineButton(config): DBIButton
|
|
380
|
+
createInlineStringSelectMenu(config): DBIStringSelectMenu
|
|
381
|
+
createInlineUserSelectMenu(config): DBIUserSelectMenu
|
|
382
|
+
createInlineRoleSelectMenu(config): DBIRoleSelectMenu
|
|
383
|
+
createInlineChannelSelectMenu(config): DBIChannelSelectMenu
|
|
384
|
+
createInlineMentionableSelectMenu(config): DBIMentionableSelectMenu
|
|
385
|
+
createInlineModal(config): DBIModal
|
|
386
|
+
createInlineEvent(config): DBIEvent
|
|
387
|
+
|
|
388
|
+
================================================================================
|
|
389
|
+
SECTION 16: onUnload
|
|
390
|
+
================================================================================
|
|
391
|
+
|
|
392
|
+
onUnload(callback: () => void | Promise<void>): void
|
|
393
|
+
|
|
394
|
+
================================================================================
|
|
395
|
+
SECTION 17: INTERACTION CLASSES
|
|
396
|
+
================================================================================
|
|
397
|
+
|
|
398
|
+
class DBIBaseInteraction {
|
|
399
|
+
dbi: DBI;
|
|
400
|
+
name: string;
|
|
401
|
+
description: string;
|
|
402
|
+
type: TDBIInteractionTypes;
|
|
403
|
+
options?: any;
|
|
404
|
+
other?: Record<string, any>;
|
|
405
|
+
rateLimits?: DBIRateLimit[];
|
|
406
|
+
flag?: string;
|
|
407
|
+
publish?: string;
|
|
408
|
+
ttl?: number;
|
|
409
|
+
at?: number;
|
|
410
|
+
|
|
411
|
+
toJSON(args?: IDBIToJSONArgs): any;
|
|
412
|
+
onExecute(ctx: IDBIBaseExecuteCtx): void | Promise<void>;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
toJSON OPTIONS:
|
|
416
|
+
---------------
|
|
417
|
+
interface IDBIToJSONArgs {
|
|
418
|
+
overrides?: Record<string, any>;
|
|
419
|
+
reference?: {
|
|
420
|
+
data?: any[];
|
|
421
|
+
ttl?: number;
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
EXECUTION CONTEXT:
|
|
426
|
+
------------------
|
|
427
|
+
interface IDBIBaseExecuteCtx {
|
|
428
|
+
interaction: Discord.Interaction;
|
|
429
|
+
locale: {
|
|
430
|
+
user: DBILocale;
|
|
431
|
+
guild?: DBILocale;
|
|
432
|
+
};
|
|
433
|
+
dbi: DBI;
|
|
434
|
+
dbiInteraction: TDBIInteractions;
|
|
435
|
+
setRateLimit: (type: TDBIRateLimitTypes, duration: number) => Promise<void>;
|
|
436
|
+
other: Record<string, any>;
|
|
437
|
+
clientNamespace: string;
|
|
438
|
+
v2: boolean;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
BUILDER METHODS:
|
|
442
|
+
----------------
|
|
443
|
+
const builder = dbi.interaction("my-btn").createBuilder();
|
|
444
|
+
builder.setLabel("Label")
|
|
445
|
+
.setEmoji("🎉")
|
|
446
|
+
.setStyle(Discord.ButtonStyle.Primary)
|
|
447
|
+
.setReference(["data"])
|
|
448
|
+
.setTTL(60000)
|
|
449
|
+
.toJSON();
|
|
450
|
+
|
|
451
|
+
const selectBuilder = dbi.interaction("my-select").createBuilder();
|
|
452
|
+
selectBuilder.setPlaceholder("Select...")
|
|
453
|
+
.setMinValues(1)
|
|
454
|
+
.setMaxValues(3)
|
|
455
|
+
.setOptions([...])
|
|
456
|
+
.toJSON();
|
|
457
|
+
|
|
458
|
+
================================================================================
|
|
459
|
+
SECTION 18: EVENT CLASSES
|
|
460
|
+
================================================================================
|
|
461
|
+
|
|
462
|
+
class DBIEvent {
|
|
463
|
+
type: "Event";
|
|
464
|
+
id?: string;
|
|
465
|
+
name: string;
|
|
466
|
+
other?: Record<string, any>;
|
|
467
|
+
triggerType?: "OneByOne" | "OneByOneGlobal" | "Random" | "First";
|
|
468
|
+
ordered?: TDBIEventOrder;
|
|
469
|
+
dbi: DBI;
|
|
470
|
+
disabled: boolean;
|
|
471
|
+
flag?: string;
|
|
472
|
+
ttl?: number;
|
|
473
|
+
at?: number;
|
|
474
|
+
|
|
475
|
+
toggle(disabled?: boolean): this;
|
|
476
|
+
onExecute(ctx): void | Promise<void>;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
EVENTS CLASS:
|
|
480
|
+
-------------
|
|
481
|
+
class Events {
|
|
482
|
+
on(
|
|
483
|
+
eventName: TDBIEventNames,
|
|
484
|
+
handler: (data: any) => boolean | Promise<boolean>,
|
|
485
|
+
options?: { once: boolean }
|
|
486
|
+
): () => void; // Returns unsubscribe function
|
|
487
|
+
|
|
488
|
+
trigger(
|
|
489
|
+
name: TDBIEventNames,
|
|
490
|
+
data?: any,
|
|
491
|
+
ignoreResponse?: boolean
|
|
492
|
+
): Promise<boolean>;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
DBI EVENT NAMES:
|
|
496
|
+
----------------
|
|
497
|
+
"beforeInteraction" | "afterInteraction" | "interactionRateLimit"
|
|
498
|
+
"beforeEvent" | "afterEvent" | "interactionError" | "eventError"
|
|
499
|
+
"messageCommandArgumentError" | "messageCommandDirectMessageUsageError"
|
|
500
|
+
"messageCommandDefaultMemberPermissionsError" | "clientsReady"
|
|
501
|
+
|
|
502
|
+
================================================================================
|
|
503
|
+
SECTION 19: LOCALE CLASSES
|
|
504
|
+
================================================================================
|
|
505
|
+
|
|
506
|
+
class DBILocale {
|
|
507
|
+
name: TDBILocaleString;
|
|
508
|
+
data: InfinitePathProxy; // Auto-callable nested object
|
|
509
|
+
_data: Record<string, any>; // Raw data
|
|
510
|
+
dbi: DBI;
|
|
511
|
+
flag?: string;
|
|
512
|
+
|
|
513
|
+
mergeLocale(locale: DBILocale): DBILocale;
|
|
514
|
+
get(path: string): string | null;
|
|
515
|
+
format(path: string, ...args: any[]): string;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
USAGE:
|
|
519
|
+
------
|
|
520
|
+
locale.data.greeting(); // "Hello!"
|
|
521
|
+
locale.data.welcome("John"); // "Welcome, John!"
|
|
522
|
+
locale.data.nested.path("a", "b"); // "a and b"
|
|
523
|
+
locale.get("greeting"); // "Hello!"
|
|
524
|
+
locale.format("welcome", "John"); // "Welcome, John!"
|
|
525
|
+
|
|
526
|
+
================================================================================
|
|
527
|
+
SECTION 20: UTILITY FUNCTIONS
|
|
528
|
+
================================================================================
|
|
529
|
+
|
|
530
|
+
const { Utils } = require("@mostfeatured/dbi");
|
|
531
|
+
|
|
532
|
+
await Utils.recursiveImport(path: string): Promise<void>
|
|
533
|
+
Utils.parseCustomId(dbi, customId: string): { name, data, v2 }
|
|
534
|
+
Utils.buildCustomId(dbi, name, data, ttl?, v2?): string
|
|
535
|
+
Utils.unloadModule(path: string): void
|
|
536
|
+
Utils.recursiveUnload(path: string): void
|
|
537
|
+
|
|
538
|
+
MEMORYSTORE:
|
|
539
|
+
------------
|
|
540
|
+
class MemoryStore {
|
|
541
|
+
async get(key: string, defaultValue?: any): Promise<any>
|
|
542
|
+
async set(key: string, value: any): Promise<void>
|
|
543
|
+
async delete(key: string): Promise<void>
|
|
544
|
+
async has(key: string): Promise<boolean>
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
================================================================================
|
|
548
|
+
SECTION 21: TYPES
|
|
549
|
+
================================================================================
|
|
550
|
+
|
|
551
|
+
RATE LIMIT TYPES:
|
|
552
|
+
-----------------
|
|
553
|
+
type TDBIRateLimitTypes = "User" | "Channel" | "Guild" | "Member" | "Message";
|
|
554
|
+
|
|
555
|
+
interface DBIRateLimit {
|
|
556
|
+
type: TDBIRateLimitTypes;
|
|
557
|
+
duration: number;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
INTERACTION TYPES:
|
|
561
|
+
------------------
|
|
562
|
+
type TDBIInteractionTypes =
|
|
563
|
+
| "ChatInput" | "UserContextMenu" | "MessageContextMenu"
|
|
564
|
+
| "Modal" | "Autocomplete" | "StringSelectMenu" | "UserSelectMenu"
|
|
565
|
+
| "ChannelSelectMenu" | "MentionableSelectMenu" | "RoleSelectMenu"
|
|
566
|
+
| "Button" | "HTMLComponentsV2";
|
|
567
|
+
|
|
568
|
+
LOCALE STRINGS:
|
|
569
|
+
---------------
|
|
570
|
+
type TDBILocaleString =
|
|
571
|
+
| "en" | "bg" | "zh" | "hr" | "cs" | "da" | "nl"
|
|
572
|
+
| "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it"
|
|
573
|
+
| "ja" | "ko" | "no" | "pl" | "pt" | "ro" | "ru"
|
|
574
|
+
| "es" | "sv" | "th" | "tr" | "uk" | "vi";
|
|
575
|
+
|
|
576
|
+
STORE INTERFACE:
|
|
577
|
+
----------------
|
|
578
|
+
interface DBIStore {
|
|
579
|
+
get(key: string, defaultValue?: any): Promise<any>;
|
|
580
|
+
set(key: string, value: any): Promise<void>;
|
|
581
|
+
delete(key: string): Promise<void>;
|
|
582
|
+
has(key: string): Promise<boolean>;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
CLIENT DATA:
|
|
586
|
+
------------
|
|
587
|
+
interface TDBIClientData {
|
|
588
|
+
namespace: string;
|
|
589
|
+
token: string;
|
|
590
|
+
options: Discord.ClientOptions;
|
|
591
|
+
client: Discord.Client<true>;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
interface ClientsArray extends Array<TDBIClientData> {
|
|
595
|
+
next(key?: string): TDBIClientData;
|
|
596
|
+
random(): TDBIClientData;
|
|
597
|
+
random(size: number): TDBIClientData[];
|
|
598
|
+
first(): TDBIClientData;
|
|
599
|
+
get(namespace: string): TDBIClientData;
|
|
600
|
+
indexes: Record<string, number>;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
REFERENCED DATA:
|
|
604
|
+
----------------
|
|
605
|
+
type TDBIReferencedData =
|
|
606
|
+
| string
|
|
607
|
+
| number
|
|
608
|
+
| {
|
|
609
|
+
[key: string]: any;
|
|
610
|
+
$ref: string;
|
|
611
|
+
$unRef(): boolean;
|
|
612
|
+
};
|
|
613
|
+
|
|
614
|
+
================================================================================
|
|
615
|
+
SECTION 22: HTMLCOMPONENTSV2 (SVELTE) METHODS
|
|
616
|
+
================================================================================
|
|
617
|
+
|
|
618
|
+
class DBIHTMLComponentsV2 {
|
|
619
|
+
async send(
|
|
620
|
+
target: Discord.Interaction | Discord.TextChannel,
|
|
621
|
+
options?: {
|
|
622
|
+
data?: Record<string, any>;
|
|
623
|
+
flags?: string[];
|
|
624
|
+
content?: string;
|
|
625
|
+
ephemeral?: boolean;
|
|
626
|
+
reply?: boolean;
|
|
627
|
+
followUp?: boolean;
|
|
628
|
+
}
|
|
629
|
+
): Promise<void>
|
|
630
|
+
|
|
631
|
+
destroy(refId: string): void
|
|
632
|
+
destroyAll(): void
|
|
633
|
+
toJSON(args?: { data?: Record<string, any> }): object
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
SVELTE GLOBALS:
|
|
637
|
+
---------------
|
|
638
|
+
let { prop1, prop2 } = $props();
|
|
639
|
+
const data: Record<string, any>;
|
|
640
|
+
|
|
641
|
+
function render(): void;
|
|
642
|
+
function update(): Promise<void>;
|
|
643
|
+
function rerender(): Promise<void>;
|
|
644
|
+
function noRender(): void;
|
|
645
|
+
function setThrottle(ms: number): void;
|
|
646
|
+
|
|
647
|
+
function onMount(callback: () => void | (() => void)): void;
|
|
648
|
+
function onDestroy(callback: () => void): void;
|
|
649
|
+
function destroy(): void;
|
|
650
|
+
|
|
651
|
+
interface HandlerContext {
|
|
652
|
+
interaction: Discord.ButtonInteraction | Discord.SelectMenuInteraction;
|
|
653
|
+
dbi: DBI;
|
|
654
|
+
locale: { user: DBILocale; guild?: DBILocale };
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
================================================================================
|
|
658
|
+
END OF DOCUMENT
|
|
659
|
+
================================================================================
|