trivious 1.3.24 → 1.3.26

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