trivious 1.3.16 → 1.3.18

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