trivious 1.3.17 → 1.3.19

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 (129) hide show
  1. package/dist/core/client/trivious.client.cjs +90 -0
  2. package/dist/core/client/trivious.client.cjs.map +1 -0
  3. package/dist/core/client/trivious.client.d.cts +3 -0
  4. package/dist/core/client/trivious.client.d.ts +3 -0
  5. package/dist/core/client/trivious.client.js +88 -0
  6. package/dist/core/client/trivious.client.js.map +1 -0
  7. package/dist/core/commands/command.base.cjs +224 -0
  8. package/dist/core/commands/command.base.cjs.map +1 -0
  9. package/dist/core/commands/command.base.d.cts +3 -0
  10. package/dist/core/commands/command.base.d.ts +3 -0
  11. package/dist/core/commands/command.base.js +214 -0
  12. package/dist/core/commands/command.base.js.map +1 -0
  13. package/dist/core/commands/contextcommand.base.cjs +98 -0
  14. package/dist/core/commands/contextcommand.base.cjs.map +1 -0
  15. package/dist/core/commands/contextcommand.base.d.cts +3 -0
  16. package/dist/core/commands/contextcommand.base.d.ts +3 -0
  17. package/dist/core/commands/contextcommand.base.js +93 -0
  18. package/dist/core/commands/contextcommand.base.js.map +1 -0
  19. package/dist/core/commands/subcommand.base.cjs +96 -0
  20. package/dist/core/commands/subcommand.base.cjs.map +1 -0
  21. package/dist/core/commands/subcommand.base.d.cts +3 -0
  22. package/dist/core/commands/subcommand.base.d.ts +3 -0
  23. package/dist/core/commands/subcommand.base.js +91 -0
  24. package/dist/core/commands/subcommand.base.js.map +1 -0
  25. package/dist/core/components/component.base.cjs +111 -0
  26. package/dist/core/components/component.base.cjs.map +1 -0
  27. package/dist/core/components/component.base.d.cts +3 -0
  28. package/dist/core/components/component.base.d.ts +3 -0
  29. package/dist/core/components/component.base.js +106 -0
  30. package/dist/core/components/component.base.js.map +1 -0
  31. package/dist/core/events/interactionCreate.cjs +68 -0
  32. package/dist/core/events/interactionCreate.cjs.map +1 -0
  33. package/dist/core/events/interactionCreate.d.cts +10 -0
  34. package/dist/core/events/interactionCreate.d.ts +10 -0
  35. package/dist/core/events/interactionCreate.js +66 -0
  36. package/dist/core/events/interactionCreate.js.map +1 -0
  37. package/dist/core/registry/command.registry.cjs +56 -0
  38. package/dist/core/registry/command.registry.cjs.map +1 -0
  39. package/dist/core/registry/command.registry.d.cts +3 -0
  40. package/dist/core/registry/command.registry.d.ts +3 -0
  41. package/dist/core/registry/command.registry.js +54 -0
  42. package/dist/core/registry/command.registry.js.map +1 -0
  43. package/dist/core/registry/component.registry.cjs +42 -0
  44. package/dist/core/registry/component.registry.cjs.map +1 -0
  45. package/dist/core/registry/component.registry.d.cts +3 -0
  46. package/dist/core/registry/component.registry.d.ts +3 -0
  47. package/dist/core/registry/component.registry.js +40 -0
  48. package/dist/core/registry/component.registry.js.map +1 -0
  49. package/dist/core/registry/event.registry.cjs +57 -0
  50. package/dist/core/registry/event.registry.cjs.map +1 -0
  51. package/dist/core/registry/event.registry.d.cts +3 -0
  52. package/dist/core/registry/event.registry.d.ts +3 -0
  53. package/dist/core/registry/event.registry.js +51 -0
  54. package/dist/core/registry/event.registry.js.map +1 -0
  55. package/dist/core/registry/index.cjs +49 -0
  56. package/dist/core/registry/index.cjs.map +1 -0
  57. package/dist/core/registry/index.d.cts +19 -0
  58. package/dist/core/registry/index.d.ts +19 -0
  59. package/dist/core/registry/index.js +39 -0
  60. package/dist/core/registry/index.js.map +1 -0
  61. package/dist/core/registry/module.registry.cjs +57 -0
  62. package/dist/core/registry/module.registry.cjs.map +1 -0
  63. package/dist/core/registry/module.registry.d.cts +3 -0
  64. package/dist/core/registry/module.registry.d.ts +3 -0
  65. package/dist/core/registry/module.registry.js +55 -0
  66. package/dist/core/registry/module.registry.js.map +1 -0
  67. package/dist/index-BPaYmWRO.d.ts +927 -0
  68. package/dist/index-CU2Xl9Xo.d.cts +927 -0
  69. package/dist/index.cjs +67 -1446
  70. package/dist/index.cjs.map +1 -1
  71. package/dist/index.d.cts +2 -974
  72. package/dist/index.d.ts +2 -974
  73. package/dist/index.js +10 -1436
  74. package/dist/index.js.map +1 -1
  75. package/dist/shared/typings/client.cjs +4 -0
  76. package/dist/shared/typings/client.cjs.map +1 -0
  77. package/dist/shared/typings/client.d.cts +3 -0
  78. package/dist/shared/typings/client.d.ts +3 -0
  79. package/dist/shared/typings/client.js +3 -0
  80. package/dist/shared/typings/client.js.map +1 -0
  81. package/dist/shared/typings/commands.cjs +4 -0
  82. package/dist/shared/typings/commands.cjs.map +1 -0
  83. package/dist/shared/typings/commands.d.cts +3 -0
  84. package/dist/shared/typings/commands.d.ts +3 -0
  85. package/dist/shared/typings/commands.js +3 -0
  86. package/dist/shared/typings/commands.js.map +1 -0
  87. package/dist/shared/typings/components.cjs +22 -0
  88. package/dist/shared/typings/components.cjs.map +1 -0
  89. package/dist/shared/typings/components.d.cts +3 -0
  90. package/dist/shared/typings/components.d.ts +3 -0
  91. package/dist/shared/typings/components.js +19 -0
  92. package/dist/shared/typings/components.js.map +1 -0
  93. package/dist/shared/typings/events.cjs +4 -0
  94. package/dist/shared/typings/events.cjs.map +1 -0
  95. package/dist/shared/typings/events.d.cts +3 -0
  96. package/dist/shared/typings/events.d.ts +3 -0
  97. package/dist/shared/typings/events.js +3 -0
  98. package/dist/shared/typings/events.js.map +1 -0
  99. package/dist/shared/typings/index.cjs +56 -0
  100. package/dist/shared/typings/index.cjs.map +1 -0
  101. package/dist/shared/typings/index.d.cts +3 -0
  102. package/dist/shared/typings/index.d.ts +3 -0
  103. package/dist/shared/typings/index.js +9 -0
  104. package/dist/shared/typings/index.js.map +1 -0
  105. package/dist/shared/typings/module.cjs +4 -0
  106. package/dist/shared/typings/module.cjs.map +1 -0
  107. package/dist/shared/typings/module.d.cts +3 -0
  108. package/dist/shared/typings/module.d.ts +3 -0
  109. package/dist/shared/typings/module.js +3 -0
  110. package/dist/shared/typings/module.js.map +1 -0
  111. package/dist/shared/typings/permissions.cjs +22 -0
  112. package/dist/shared/typings/permissions.cjs.map +1 -0
  113. package/dist/shared/typings/permissions.d.cts +3 -0
  114. package/dist/shared/typings/permissions.d.ts +3 -0
  115. package/dist/shared/typings/permissions.js +19 -0
  116. package/dist/shared/typings/permissions.js.map +1 -0
  117. package/dist/shared/typings/registry.cjs +63 -0
  118. package/dist/shared/typings/registry.cjs.map +1 -0
  119. package/dist/shared/typings/registry.d.cts +51 -0
  120. package/dist/shared/typings/registry.d.ts +51 -0
  121. package/dist/shared/typings/registry.js +61 -0
  122. package/dist/shared/typings/registry.js.map +1 -0
  123. package/dist/shared/utility/functions.cjs +81 -0
  124. package/dist/shared/utility/functions.cjs.map +1 -0
  125. package/dist/shared/utility/functions.d.cts +56 -0
  126. package/dist/shared/utility/functions.d.ts +56 -0
  127. package/dist/shared/utility/functions.js +74 -0
  128. package/dist/shared/utility/functions.js.map +1 -0
  129. package/package.json +2 -2
package/dist/index.d.cts CHANGED
@@ -1,975 +1,3 @@
1
- import * as discord_js from 'discord.js';
2
- import { GuildMember, Collection, AnySelectMenuInteraction, CacheType, ButtonInteraction as ButtonInteraction$1, ModalSubmitInteraction as ModalSubmitInteraction$1, SlashCommandSubcommandBuilder, ChatInputCommandInteraction as ChatInputCommandInteraction$1, MessagePayload, InteractionEditReplyOptions, InteractionReplyOptions, ContextMenuCommandBuilder, SlashCommandBuilder, ClientOptions, ClientEvents, ComponentType as ComponentType$1, Client, StringSelectMenuInteraction as StringSelectMenuInteraction$1, ContextMenuCommandInteraction as ContextMenuCommandInteraction$1 } from 'discord.js';
3
1
  export { ClientEvents, Collection } from 'discord.js';
4
-
5
- /**
6
- * User permission level enums
7
- *
8
- * @export
9
- * @enum {number}
10
- */
11
- declare enum PermissionLevel {
12
- USER = 0,
13
- GUILD_STAFF = 1,
14
- GUILD_MODERATOR = 2,
15
- GUILD_ADMINISTRATOR = 3,
16
- GUILD_OWNER = 4,
17
- BOT_OWNER = 5
18
- }
19
- /**
20
- * Get the permission level of a user.
21
- *
22
- * @param {GuildMember} member
23
- * @returns {*}
24
- */
25
- declare const getPermissionLevel: (client: TriviousClient, member: GuildMember) => PermissionLevel;
26
-
27
- /**
28
- * Base registry for loading, getting and binding core events and functions.
29
- *
30
- * @export
31
- * @abstract
32
- * @class BaseRegistry
33
- * @typedef {BaseRegistry}
34
- * @template T
35
- */
36
- declare abstract class BaseRegistry<T> {
37
- protected abstract items: Collection<string, T>;
38
- /**
39
- * Load all of T
40
- *
41
- * @protected
42
- * @abstract
43
- * @param {string} directory
44
- * @returns {Promise<this>}
45
- */
46
- protected abstract load(directory: string): Promise<this>;
47
- /**
48
- * Get all of loaded T
49
- *
50
- * @returns {Collection<string, T>}
51
- */
52
- get(): Collection<string, T>;
53
- /**
54
- * Import a file from a path to be loaded.
55
- *
56
- * @protected
57
- * @async
58
- * @template T
59
- * @param {string} filePath
60
- * @returns {Promise<T | null>}
61
- */
62
- protected importFile<T>(filePath: string): Promise<T | null>;
63
- /**
64
- * Clear file path cache.
65
- * Does not run in production environment.
66
- *
67
- * @protected
68
- * @async
69
- * @param {string} filePath
70
- * @returns {*}
71
- */
72
- protected clearCache(filePath: string): Promise<void>;
73
- }
74
-
75
- /**
76
- * Tags for component customIds.
77
- *
78
- * @export
79
- * @typedef {ComponentCustomIdTag}
80
- */
81
- type ComponentCustomIdTag = "awaited";
82
- /**
83
- * Interaction types for components.
84
- *
85
- * @export
86
- * @typedef {ComponentInteraction}
87
- */
88
- type ComponentInteraction = AnySelectMenuInteraction<CacheType> | ButtonInteraction$1<CacheType> | ModalSubmitInteraction$1<CacheType>;
89
- /**
90
- * What type of component is the componenty.
91
- *
92
- * @export
93
- * @enum {number}
94
- */
95
- declare enum ComponentType {
96
- Button = "button",
97
- SelectMenu = "select",
98
- Modal = "modal"
99
- }
100
- /**
101
- * Metadata for Components.
102
- *
103
- * @export
104
- * @interface ComponentMetadata
105
- * @typedef {ComponentMetadata}
106
- */
107
- interface ComponentMetadata {
108
- /**
109
- * The customId of the component.
110
- *
111
- * @type {string}
112
- */
113
- customId: string;
114
- /**
115
- * The permission level required to use the component.
116
- *
117
- * @type {PermissionLevel}
118
- */
119
- permission: PermissionLevel;
120
- /**
121
- * Whether the interaction reply is ephemeral.
122
- *
123
- * @type {boolean}
124
- */
125
- ephemeralReply: boolean;
126
- }
127
- /**
128
- * Deconstruct a component customId into its parts.
129
- *
130
- * @param {string} customId
131
- * @returns {{ componentType: ComponentType; data: string; tags: {}; }}
132
- */
133
- declare const deconstructCustomId: (customId: string) => {
134
- componentType: ComponentType;
135
- data: string;
136
- tags: "awaited"[];
137
- };
138
-
139
- /**
140
- * Base SubcommandBuilder.
141
- *
142
- * @export
143
- * @class SubcommandBuilder
144
- * @typedef {SubcommandBuilder}
145
- * @extends {SlashCommandSubcommandBuilder}
146
- */
147
- declare class SubcommandBuilder extends SlashCommandSubcommandBuilder {
148
- private _active;
149
- private _ownerOnly;
150
- private _permission;
151
- private _ephemeralReply;
152
- /**
153
- * Set the subcommand as disabled.
154
- *
155
- * @public
156
- * @returns {this}
157
- */
158
- disable(): this;
159
- /**
160
- * Set the subcommand as owner only.
161
- *
162
- * @public
163
- * @returns {this}
164
- */
165
- setOwnerOnly(): this;
166
- /**
167
- * Set the permission level required to run the subcommand.
168
- *
169
- * @public
170
- * @param {PermissionLevel} permission
171
- * @returns {this}
172
- */
173
- setPermission(permission: PermissionLevel): this;
174
- /**
175
- * Set the interaction as ephemeral
176
- *
177
- * @public
178
- * @returns {this}
179
- */
180
- setEphemeralReply(): this;
181
- /**
182
- * Build the builder.
183
- *
184
- * @public
185
- * @returns {{ data: SlashCommandSubcommandBuilder; metadata: SubcommandMetadata; }}
186
- */
187
- build(): {
188
- data: SlashCommandSubcommandBuilder;
189
- metadata: {
190
- active: boolean;
191
- ownerOnly: boolean;
192
- permission: PermissionLevel;
193
- ephemeralReply: boolean;
194
- };
195
- };
196
- }
197
- /**
198
- * Base Subcommand
199
- *
200
- * @export
201
- * @abstract
202
- * @class Subcommand
203
- * @typedef {Subcommand}
204
- */
205
- declare abstract class Subcommand {
206
- abstract data: SlashCommandSubcommandBuilder;
207
- abstract metadata: SubcommandMetadata;
208
- /**
209
- * Function to execute the subcommand.
210
- *
211
- * @abstract
212
- * @readonly
213
- * @type {(
214
- * client: TriviousClient,
215
- * interaction: ChatInputCommandInteraction<CacheType>
216
- * ) => Promise<void>}
217
- */
218
- abstract readonly execute: (client: TriviousClient, interaction: ChatInputCommandInteraction$1<CacheType>) => Promise<void>;
219
- /**
220
- * Reply to the interaction respecting command metadata and if the interaction has already been replied to.
221
- *
222
- * @async
223
- * @param {ChatInputCommandInteraction<CacheType>} interaction
224
- * @param {(MessagePayload | InteractionEditReplyOptions | InteractionReplyOptions)} options
225
- * @returns {*}
226
- */
227
- reply(interaction: ChatInputCommandInteraction$1<CacheType>, options: MessagePayload | InteractionEditReplyOptions | InteractionReplyOptions): Promise<void>;
228
- }
229
-
230
- /**
231
- * Base ContextMenuCommand.
232
- *
233
- * @export
234
- * @abstract
235
- * @class ContextMenuCommand
236
- * @typedef {ContextMenuCommand}
237
- * @extends {Command}
238
- */
239
- declare abstract class ContextMenuCommand extends Command {
240
- abstract data: ContextMenuCommandBuilder;
241
- abstract metadata: ContextMenuMetadata;
242
- /**
243
- * Function to run when the command is used.
244
- *
245
- * @abstract
246
- * @type {(
247
- * client: TriviousClient,
248
- * interaction: ContextMenuCommandInteraction
249
- * ) => Promise<void>}
250
- */
251
- abstract run: (client: TriviousClient, interaction: ContextMenuCommandInteraction) => Promise<void>;
252
- /**
253
- * Base command handler.
254
- *
255
- * @public
256
- * @async
257
- * @param {TriviousClient} client
258
- * @param {ContextMenuCommandInteraction} interaction
259
- * @returns {*}
260
- */
261
- execute(client: TriviousClient, interaction: ContextMenuCommandInteraction): Promise<void>;
262
- }
263
- /**
264
- * Base ContextMenuBuilder.
265
- *
266
- * @export
267
- * @class ContextMenuBuilder
268
- * @typedef {ContextMenuBuilder}
269
- * @extends {ContextMenuCommandBuilder}
270
- */
271
- declare class ContextMenuBuilder extends ContextMenuCommandBuilder {
272
- private _active;
273
- private _ownerOnly;
274
- private _permission;
275
- private _ephemeralReply;
276
- /**
277
- * Set the command as disabled.
278
- *
279
- * @public
280
- * @returns {this}
281
- */
282
- disable(): this;
283
- /**
284
- * Set the command as owner only.
285
- *
286
- * @public
287
- * @returns {this}
288
- */
289
- setOwnerOnly(): this;
290
- /**
291
- * Set the permission level required to run the command.
292
- *
293
- * @public
294
- * @param {PermissionLevel} permission
295
- * @returns {this}
296
- */
297
- setPermission(permission: PermissionLevel): this;
298
- /**
299
- * Set the interaction as ephemeral.
300
- *
301
- * @public
302
- * @returns {this}
303
- */
304
- setEphemeralReply(): this;
305
- /**
306
- * Build the builder
307
- *
308
- * @public
309
- * @returns {{ data: ContextMenuBuilder; metadata: ContextMenuMetadata; }}
310
- */
311
- build(): {
312
- data: ContextMenuBuilder;
313
- metadata: {
314
- active: boolean;
315
- ownerOnly: boolean;
316
- permission: PermissionLevel;
317
- ephemeralReply: boolean;
318
- };
319
- };
320
- }
321
-
322
- /**
323
- * Base class for a Command.
324
- *
325
- * @export
326
- * @abstract
327
- * @class Command
328
- * @typedef {Command}
329
- */
330
- declare abstract class Command {
331
- abstract data: SlashCommandBuilder | ContextMenuCommandBuilder;
332
- abstract metadata: CommandMetadata | ContextMenuMetadata;
333
- /**
334
- * Returns whether the command is a SlashCommand.
335
- *
336
- * @public
337
- * @param {Command} this
338
- * @returns {this is SlashCommand}
339
- */
340
- isSlashCommand(this: Command): this is SlashCommand;
341
- /**
342
- * Returns whether the command is a ContextMenuCommand.
343
- *
344
- * @public
345
- * @param {Command} this
346
- * @returns {this is ContextMenuCommand}
347
- */
348
- isContextMenuCommand(this: Command): this is ContextMenuCommand;
349
- /**
350
- * Returns JSON of the command builder.
351
- *
352
- * @public
353
- * @returns {*}
354
- */
355
- toJSON(): discord_js.RESTPostAPIChatInputApplicationCommandsJSONBody | discord_js.RESTPostAPIContextMenuApplicationCommandsJSONBody;
356
- /**
357
- * Reply to the interaction respecting command metadata and if the interaction has already been replied to.
358
- *
359
- * @public
360
- * @async
361
- * @param {CommandInteraction} interaction
362
- * @param {(MessagePayload | InteractionEditReplyOptions | InteractionReplyOptions)} options
363
- * @returns {*}
364
- */
365
- reply(interaction: CommandInteraction, options: MessagePayload | InteractionEditReplyOptions | InteractionReplyOptions): Promise<void>;
366
- /**
367
- * Validate permissions for a user/member in a guild.
368
- *
369
- * @async
370
- * @param {CommandInteraction} interaction
371
- * @param {PermissionLevel} permission
372
- * @param {boolean} [doReply=true]
373
- * @returns {unknown}
374
- */
375
- validateGuildPermission(client: TriviousClient, interaction: CommandInteraction, permission: PermissionLevel, doReply?: boolean): Promise<boolean>;
376
- }
377
- /**
378
- * Base SlashCommand.
379
- *
380
- * @export
381
- * @abstract
382
- * @class SlashCommand
383
- * @typedef {SlashCommand}
384
- * @extends {Command}
385
- */
386
- declare abstract class SlashCommand extends Command {
387
- abstract data: SlashCommandBuilder;
388
- abstract metadata: CommandMetadata;
389
- /**
390
- * Optional function to run if the SlashCommand has no subcommands or for extra fuctionality.
391
- *
392
- * @abstract
393
- * @type {?(
394
- * client: TriviousClient,
395
- * interaction: ChatInputCommandInteraction
396
- * ) => Promise<void>}
397
- */
398
- run?: (client: TriviousClient, interaction: ChatInputCommandInteraction) => Promise<void>;
399
- /**
400
- * General handler for the command and its subcommand, if applicable.
401
- *
402
- * @public
403
- * @async
404
- * @param {TriviousClient} client
405
- * @param {ChatInputCommandInteraction} interaction
406
- * @returns {*}
407
- */
408
- execute(client: TriviousClient, interaction: ChatInputCommandInteraction): Promise<void>;
409
- }
410
- /**
411
- * Base CommandBuilder.
412
- *
413
- * @export
414
- * @class CommandBuilder
415
- * @typedef {CommandBuilder}
416
- * @extends {SlashCommandBuilder}
417
- */
418
- declare class CommandBuilder extends SlashCommandBuilder {
419
- private _active;
420
- private _guildOnly;
421
- private _ownerOnly;
422
- private _permission;
423
- private _subcommands;
424
- private _ephemeralReply;
425
- /**
426
- * Set the command as disabled.
427
- *
428
- * @public
429
- * @returns {this}
430
- */
431
- disable(): this;
432
- /**
433
- * Set the command as guild only.
434
- *
435
- * @public
436
- * @returns {this}
437
- */
438
- setGuildOnly(): this;
439
- /**
440
- * Set the command as public only.
441
- *
442
- * @public
443
- * @returns {this}
444
- */
445
- setOwnerOnly(): this;
446
- /**
447
- * Set the permission level required to run the command.
448
- *
449
- * @public
450
- * @param {PermissionLevel} permission
451
- * @returns {this}
452
- */
453
- setPermission(permission: PermissionLevel): this;
454
- /**
455
- * Set the interaction as ephemeral.
456
- *
457
- * @public
458
- * @returns {this}
459
- */
460
- setEphemeralReply(): this;
461
- /**
462
- * Build the builder.
463
- *
464
- * @public
465
- * @returns {{ data: CommandBuilder; metadata: CommandMetadata; }}
466
- */
467
- build(): {
468
- data: CommandBuilder;
469
- metadata: {
470
- active: boolean;
471
- guildOnly: boolean;
472
- ownerOnly: boolean;
473
- permission: PermissionLevel;
474
- subcommands: Collection<string, Subcommand>;
475
- ephemeralReply: boolean;
476
- };
477
- };
478
- }
479
-
480
- /**
481
- * Literal type for possible CommandInteractions.
482
- *
483
- * @export
484
- * @typedef {CommandInteraction}
485
- */
486
- type CommandInteraction = ChatInputCommandInteraction | ContextMenuCommandInteraction;
487
- /**
488
- * Metadata for Commands.
489
- *
490
- * @export
491
- * @interface CommandMetadata
492
- * @typedef {CommandMetadata}
493
- */
494
- interface CommandMetadata {
495
- /**
496
- * Whether the command is active, if `false`, the command is skipped during loading and deployment.
497
- *
498
- * @type {boolean}
499
- */
500
- active: boolean;
501
- /**
502
- * Whether the command is guild-only.
503
- *
504
- * @type {boolean}
505
- */
506
- guildOnly: boolean;
507
- /**
508
- * Whether the command is owner-only.
509
- *
510
- * @type {boolean}
511
- */
512
- ownerOnly: boolean;
513
- /**
514
- * The permission level required to use the command.
515
- *
516
- * @type {PermissionLevel}
517
- */
518
- permission: PermissionLevel;
519
- /**
520
- * Collection of subcommands.
521
- *
522
- * @type {Collection<string, Subcommand>}
523
- */
524
- subcommands: Collection<string, Subcommand>;
525
- /**
526
- * Whether the interaction is ephemeral.
527
- *
528
- * @type {boolean}
529
- */
530
- ephemeralReply: boolean;
531
- }
532
- /**
533
- * Metadata for Subcommands.
534
- *
535
- * @export
536
- * @interface SubcommandMetadata
537
- * @typedef {SubcommandMetadata}
538
- */
539
- interface SubcommandMetadata {
540
- /**
541
- * Whether the subcommand is active, if `false`, the command is skipped during loading.
542
- *
543
- * @type {boolean}
544
- */
545
- active: boolean;
546
- /**
547
- * Whether the subcommand is owner-only.
548
- *
549
- * @type {boolean}
550
- */
551
- ownerOnly: boolean;
552
- /**
553
- * The permission level required to use the subcommand.
554
- *
555
- * @type {PermissionLevel}
556
- */
557
- permission: PermissionLevel;
558
- /**
559
- * Whether the interaction is ephemeral.
560
- *
561
- * @type {boolean}
562
- */
563
- ephemeralReply: boolean;
564
- }
565
- /**
566
- * Metadata for ContextMenuCommands.
567
- *
568
- * @export
569
- * @interface ContextMenuMetadata
570
- * @typedef {ContextMenuMetadata}
571
- */
572
- interface ContextMenuMetadata {
573
- /**
574
- * Whether the command is active, if `false`, the command is skipped during loading and deployment.
575
- *
576
- * @type {boolean}
577
- */
578
- active: boolean;
579
- /**
580
- * Whether the command is owner-only.
581
- *
582
- * @type {boolean}
583
- */
584
- ownerOnly: boolean;
585
- /**
586
- * The permission level required to use the command.
587
- *
588
- * @type {PermissionLevel}
589
- */
590
- permission: PermissionLevel;
591
- /**
592
- * Whether the interaction is ephemeral.
593
- *
594
- * @type {boolean}
595
- */
596
- ephemeralReply: boolean;
597
- }
598
- /**
599
- * Literal type for generic Command use.
600
- *
601
- * @export
602
- * @typedef {AnyCommand}
603
- */
604
- type AnyCommand = SlashCommand | ContextMenuCommand;
605
-
606
- /**
607
- * Client options for the TriviousClient
608
- *
609
- * @export
610
- * @interface TriviousClientOptions
611
- * @typedef {TriviousClientOptions}
612
- * @extends {ClientOptions}
613
- */
614
- interface TriviousClientOptions extends ClientOptions {
615
- /**
616
- * Environment variable for the bot token.
617
- *
618
- * @type {string}
619
- */
620
- tokenReference: string;
621
- /**
622
- * Environment variable for the client id.
623
- *
624
- * @type {string}
625
- */
626
- clientIdReference: string;
627
- /**
628
- * Set core paths for where the registries should look.
629
- *
630
- * @type {?{
631
- * commandsPath?: string;
632
- * componentsPath?: string;
633
- * eventsPath?: string;
634
- * modulesPath?: string;
635
- * }}
636
- */
637
- corePaths?: {
638
- commandsPath?: string;
639
- componentsPath?: string;
640
- eventsPath?: string;
641
- modulesPath?: string;
642
- };
643
- /**
644
- * Set base core path, only use if you aren't defining corePaths. This is intended for the case where all your registry folders are in the same directory.
645
- *
646
- * @type {?string}
647
- */
648
- corePath?: string;
649
- /**
650
- * Roles tied to a PermissionLevel.
651
- *
652
- * @type {Record<string, PermissionLevel>}
653
- */
654
- rolePermissions?: Record<string, PermissionLevel>;
655
- }
656
-
657
- /**
658
- * Base Event.
659
- *
660
- * @export
661
- * @interface Event
662
- * @typedef {Event}
663
- * @template {keyof ClientEvents} [K=keyof ClientEvents]
664
- */
665
- interface Event<K extends keyof ClientEvents = keyof ClientEvents> {
666
- /**
667
- * Name of the ClientEvent.
668
- *
669
- * @type {K}
670
- */
671
- name: K;
672
- /**
673
- * Whether the event is once.
674
- *
675
- * @type {?boolean}
676
- */
677
- once?: boolean;
678
- /**
679
- * Execute the event.
680
- *
681
- * @type {(client: TriviousClient, ...args: ClientEvents[K]) => Promise<void> | void}
682
- */
683
- execute: (client: TriviousClient, ...args: ClientEvents[K]) => Promise<void> | void;
684
- }
685
-
686
- /**
687
- * Base Module.
688
- *
689
- * @export
690
- * @interface Module
691
- * @typedef {Module}
692
- */
693
- interface Module {
694
- /**
695
- * The name of the Module.
696
- *
697
- * @type {string}
698
- */
699
- name: string;
700
- /**
701
- * The events the module is listening for.
702
- *
703
- * @type {{
704
- * [K in keyof ClientEvents]?: (
705
- * client: TriviousClient,
706
- * ...args: ClientEvents[K]
707
- * ) => Promise<void> | void;
708
- * }}
709
- */
710
- events?: {
711
- [K in keyof ClientEvents]?: (client: TriviousClient, ...args: ClientEvents[K]) => Promise<void> | void;
712
- };
713
- }
714
-
715
- /**
716
- * Registry to load, get and bind modules.
717
- *
718
- * @export
719
- * @class ModuleRegistry
720
- * @typedef {ModuleRegistry}
721
- * @extends {BaseRegistry<Module>}
722
- */
723
- declare class ModuleRegistry extends BaseRegistry<Module> {
724
- protected items: Collection<string, Module>;
725
- /**
726
- * Load all modules.
727
- *
728
- * @async
729
- * @param {string} [directory=getCorePath({ coreDirectory: "module" })]
730
- * @returns {Promise<this>}
731
- */
732
- load(directory?: string): Promise<this>;
733
- /**
734
- * Bind all loaded modules to their client event respectively.
735
- *
736
- * @param {TriviousClient} client
737
- */
738
- bind(client: TriviousClient): void;
739
- }
740
-
741
- /**
742
- * Registry to load, get and bind events.
743
- *
744
- * @export
745
- * @class EventRegistry
746
- * @typedef {EventRegistry}
747
- * @extends {BaseRegistry<Event>}
748
- */
749
- declare class EventRegistry extends BaseRegistry<Event> {
750
- protected items: Collection<string, Event<keyof ClientEvents>>;
751
- /**
752
- * Load all events.
753
- *
754
- * @async
755
- * @param {string} [directory=getCorePath({ coreDirectory: "events" })]
756
- * @returns {Promise<this>}
757
- */
758
- load(directory?: string): Promise<this>;
759
- /**
760
- * Bind loaded events to their client events respectively.
761
- *
762
- * @param {TriviousClient} client
763
- */
764
- bind(client: TriviousClient): void;
765
- }
766
-
767
- /**
768
- * Base ComponentBuilder.
769
- *
770
- * @export
771
- * @class ComponentBuilder
772
- * @typedef {ComponentBuilder}
773
- */
774
- declare class ComponentBuilder {
775
- private _customId;
776
- private _permission;
777
- private _ephemeralReply;
778
- /**
779
- * Set the customId for the component.
780
- *
781
- * @public
782
- * @param {{
783
- * type: ComponentType;
784
- * data: string;
785
- * tags?: ComponentCustomIdTag[];
786
- * }} options
787
- * @returns {this}
788
- */
789
- setCustomId(options: {
790
- type: ComponentType$1;
791
- data: string;
792
- tags?: ComponentCustomIdTag[];
793
- }): this;
794
- /**
795
- * Set the permission required to use the component.
796
- *
797
- * @public
798
- * @param {PermissionLevel} permission
799
- * @returns {this}
800
- */
801
- setPermission(permission: PermissionLevel): this;
802
- /**
803
- * Set the interaction as ephemeral.
804
- *
805
- * @public
806
- * @returns {this}
807
- */
808
- setEphemeralReply(): this;
809
- /**
810
- * Builder the builder.
811
- *
812
- * @public
813
- * @returns {{ metadata: ComponentMetadata; }}
814
- */
815
- build(): {
816
- metadata: {
817
- customId: string;
818
- permission: PermissionLevel;
819
- ephemeralReply: boolean;
820
- };
821
- };
822
- }
823
- /**
824
- * Base Component.
825
- *
826
- * @export
827
- * @abstract
828
- * @class Component
829
- * @typedef {Component}
830
- */
831
- declare abstract class Component {
832
- abstract metadata: ComponentMetadata;
833
- /**
834
- * Execute the component.
835
- *
836
- * @abstract
837
- * @type {(client: TriviousClient, interaction: ComponentInteraction) => Promise<void>}
838
- */
839
- abstract execute: (client: TriviousClient, interaction: ComponentInteraction) => Promise<void>;
840
- /**
841
- * Validate permissions for a user/member in a guild.
842
- *
843
- * @async
844
- * @param {ComponentInteraction} interaction
845
- * @param {PermissionLevel} permission
846
- * @param {boolean} [doReply=true] Defaults to `true`
847
- * @returns {unknown}
848
- */
849
- validateGuildPermission(client: TriviousClient, interaction: ComponentInteraction, permission: PermissionLevel, doReply?: boolean): Promise<boolean>;
850
- /**
851
- * Reply to the interaction respecting command metadata and if the interaction has already been replied to.
852
- *
853
- * @async
854
- * @param {ComponentInteraction} interaction
855
- * @param {(MessagePayload | InteractionEditReplyOptions | InteractionReplyOptions)} options
856
- * @returns {*}
857
- */
858
- reply(interaction: ComponentInteraction, options: MessagePayload | InteractionEditReplyOptions | InteractionReplyOptions): Promise<void>;
859
- }
860
-
861
- /**
862
- * Registry to load and get all components.
863
- *
864
- * @export
865
- * @class ComponentRegistry
866
- * @typedef {ComponentRegistry}
867
- * @extends {BaseRegistry<Component>}
868
- */
869
- declare class ComponentRegistry extends BaseRegistry<Component> {
870
- protected items: Collection<string, Component>;
871
- /**
872
- * Load all components.
873
- *
874
- * @async
875
- * @param {string} [directory=getCorePath({ coreDirectory: "components" })]
876
- * @returns {Promise<this>}
877
- */
878
- load(directory?: string): Promise<this>;
879
- }
880
-
881
- /**
882
- * Registry to load and get all commands.
883
- *
884
- * @export
885
- * @class CommandRegistry
886
- * @typedef {CommandRegistry}
887
- * @extends {BaseRegistry<AnyCommand>}
888
- */
889
- declare class CommandRegistry extends BaseRegistry<AnyCommand> {
890
- protected items: Collection<string, AnyCommand>;
891
- /**
892
- * Load all commands and their subcommands
893
- *
894
- * @async
895
- * @param {string} [directory=getCorePath({ coreDirectory: "commands" })]
896
- * @returns {unknown}
897
- */
898
- load(directory?: string): Promise<this>;
899
- }
900
-
901
- /**
902
- * Trivious base client.
903
- *
904
- * @export
905
- * @class TriviousClient
906
- * @typedef {TriviousClient}
907
- * @extends {Client}
908
- */
909
- declare class TriviousClient extends Client {
910
- /**
911
- * Client registries.
912
- *
913
- * @public
914
- * @readonly
915
- * @type {*}
916
- */
917
- readonly registries: {
918
- commands: CommandRegistry;
919
- components: ComponentRegistry;
920
- events: EventRegistry;
921
- modules: ModuleRegistry;
922
- loadAll(options: TriviousClientOptions): Promise<void>;
923
- bind(client: TriviousClient): void;
924
- };
925
- /**
926
- * Client copy of the constructor options.
927
- *
928
- * @private
929
- * @type {TriviousClientOptions}
930
- */
931
- private _options;
932
- /**
933
- * Creates an instance of TriviousClient.
934
- *
935
- * @constructor
936
- * @param {TriviousClientOptions} options
937
- */
938
- constructor(options: TriviousClientOptions);
939
- /**
940
- * Load all registries.
941
- *
942
- * @async
943
- * @returns {*}
944
- */
945
- register(): Promise<void>;
946
- /**
947
- * Login and start the bot.
948
- *
949
- * @async
950
- * @returns {*}
951
- */
952
- start(): Promise<void>;
953
- /**
954
- * Deploy all commands.
955
- *
956
- * @async
957
- * @returns {*}
958
- */
959
- deploy(): Promise<void>;
960
- /**
961
- * Set the roles tied to a permission level.
962
- *
963
- * @param {Record<string, PermissionLevel>} roles
964
- */
965
- setRolePermissions(roles: Record<string, PermissionLevel>): void;
966
- get rolePermissions(): Record<string, PermissionLevel>;
967
- }
968
-
969
- type ChatInputCommandInteraction = ChatInputCommandInteraction$1<CacheType>;
970
- type ButtonInteraction = ButtonInteraction$1<CacheType>;
971
- type StringSelectMenuInteraction = StringSelectMenuInteraction$1<CacheType>;
972
- type ModalSubmitInteraction = ModalSubmitInteraction$1<CacheType>;
973
- type ContextMenuCommandInteraction = ContextMenuCommandInteraction$1<CacheType>;
974
-
975
- export { type AnyCommand, BaseRegistry, type ButtonInteraction, type ChatInputCommandInteraction, Command, CommandBuilder, type CommandInteraction, type CommandMetadata, CommandRegistry, Component, ComponentBuilder, type ComponentCustomIdTag, type ComponentInteraction, type ComponentMetadata, ComponentRegistry, ComponentType, ContextMenuBuilder, ContextMenuCommand, type ContextMenuCommandInteraction, type ContextMenuMetadata, type Event, type ModalSubmitInteraction, type Module, PermissionLevel, SlashCommand, type StringSelectMenuInteraction, Subcommand, SubcommandBuilder, type SubcommandMetadata, TriviousClient, type TriviousClientOptions, deconstructCustomId, getPermissionLevel };
2
+ export { A as AnyCommand, B as ButtonInteraction, w as ChatInputCommandInteraction, k as Command, l as CommandBuilder, o as CommandInteraction, p as CommandMetadata, C as CommandRegistry, u as Component, v as ComponentBuilder, c as ComponentCustomIdTag, d as ComponentInteraction, f as ComponentMetadata, a as ComponentRegistry, e as ComponentType, j as ContextMenuBuilder, i as ContextMenuCommand, z as ContextMenuCommandInteraction, r as ContextMenuMetadata, s as Event, y as ModalSubmitInteraction, t as Module, P as PermissionLevel, S as SlashCommand, x as StringSelectMenuInteraction, m as Subcommand, n as SubcommandBuilder, q as SubcommandMetadata, T as TriviousClient, b as TriviousClientOptions, h as deconstructCustomId, g as getPermissionLevel } from './index-CU2Xl9Xo.cjs';
3
+ export { BaseRegistry } from './shared/typings/registry.cjs';