trivious 1.3.20 → 1.3.22

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