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
package/dist/index.d.cts CHANGED
@@ -1,987 +1,3 @@
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
- * Discord user Ids of the bot owner(s)
655
- *
656
- * @type {string[]}
657
- */
658
- botOwnerIds?: string[];
659
- }
660
-
661
- /**
662
- * Base Event.
663
- *
664
- * @export
665
- * @interface Event
666
- * @typedef {Event}
667
- * @template {keyof ClientEvents} [K=keyof ClientEvents]
668
- */
669
- interface Event<K extends keyof ClientEvents = keyof ClientEvents> {
670
- /**
671
- * Name of the ClientEvent.
672
- *
673
- * @type {K}
674
- */
675
- name: K;
676
- /**
677
- * Whether the event is once.
678
- *
679
- * @type {?boolean}
680
- */
681
- once?: boolean;
682
- /**
683
- * Execute the event.
684
- *
685
- * @type {(client: TriviousClient, ...args: ClientEvents[K]) => Promise<void> | void}
686
- */
687
- execute: (client: TriviousClient, ...args: ClientEvents[K]) => Promise<void> | void;
688
- }
689
-
690
- /**
691
- * Base Module.
692
- *
693
- * @export
694
- * @interface Module
695
- * @typedef {Module}
696
- */
697
- interface Module {
698
- /**
699
- * The name of the Module.
700
- *
701
- * @type {string}
702
- */
703
- name: string;
704
- /**
705
- * The events the module is listening for.
706
- *
707
- * @type {{
708
- * [K in keyof ClientEvents]?: (
709
- * client: TriviousClient,
710
- * ...args: ClientEvents[K]
711
- * ) => Promise<void> | void;
712
- * }}
713
- */
714
- events?: {
715
- [K in keyof ClientEvents]?: (client: TriviousClient, ...args: ClientEvents[K]) => Promise<void> | void;
716
- };
717
- }
718
-
719
- /**
720
- * Registry to load, get and bind modules.
721
- *
722
- * @export
723
- * @class ModuleRegistry
724
- * @typedef {ModuleRegistry}
725
- * @extends {BaseRegistry<Module>}
726
- */
727
- declare class ModuleRegistry extends BaseRegistry<Module> {
728
- protected items: Collection<string, Module>;
729
- /**
730
- * Load all modules.
731
- *
732
- * @async
733
- * @param {string} [directory=getCorePath({ coreDirectory: "module" })]
734
- * @returns {Promise<this>}
735
- */
736
- load(directory?: string): Promise<this>;
737
- /**
738
- * Bind all loaded modules to their client event respectively.
739
- *
740
- * @param {TriviousClient} client
741
- */
742
- bind(client: TriviousClient): void;
743
- }
744
-
745
- /**
746
- * Registry to load, get and bind events.
747
- *
748
- * @export
749
- * @class EventRegistry
750
- * @typedef {EventRegistry}
751
- * @extends {BaseRegistry<Event>}
752
- */
753
- declare class EventRegistry extends BaseRegistry<Event> {
754
- protected items: Collection<string, Event<keyof ClientEvents>>;
755
- /**
756
- * Load all preset events, can be overridden by user-provided events.
757
- *
758
- * @async
759
- * @protected
760
- * @returns {Promise<this>}
761
- */
762
- protected loadPresetEvents(): Promise<this>;
763
- /**
764
- * Load all events.
765
- *
766
- * @async
767
- * @param {string} [directory=getCorePath({ coreDirectory: "events" })]
768
- * @returns {Promise<this>}
769
- */
770
- load(directory?: string): Promise<this>;
771
- /**
772
- * Bind loaded events to their client events respectively.
773
- *
774
- * @param {TriviousClient} client
775
- */
776
- bind(client: TriviousClient): void;
777
- }
778
-
779
- /**
780
- * Base ComponentBuilder.
781
- *
782
- * @export
783
- * @class ComponentBuilder
784
- * @typedef {ComponentBuilder}
785
- */
786
- declare class ComponentBuilder {
787
- private _customId;
788
- private _permission;
789
- private _ephemeralReply;
790
- /**
791
- * Set the customId for the component.
792
- *
793
- * @public
794
- * @param {{
795
- * type: ComponentType;
796
- * data: string;
797
- * tags?: ComponentCustomIdTag[];
798
- * }} options
799
- * @returns {this}
800
- */
801
- setCustomId(options: {
802
- type: ComponentType$1;
803
- data: string;
804
- tags?: ComponentCustomIdTag[];
805
- }): this;
806
- /**
807
- * Set the permission required to use the component.
808
- *
809
- * @public
810
- * @param {PermissionLevel} permission
811
- * @returns {this}
812
- */
813
- setPermission(permission: PermissionLevel): this;
814
- /**
815
- * Set the interaction as ephemeral.
816
- *
817
- * @public
818
- * @returns {this}
819
- */
820
- setEphemeralReply(): this;
821
- /**
822
- * Builder the builder.
823
- *
824
- * @public
825
- * @returns {{ metadata: ComponentMetadata; }}
826
- */
827
- build(): {
828
- metadata: {
829
- customId: string;
830
- permission: PermissionLevel;
831
- ephemeralReply: boolean;
832
- };
833
- };
834
- }
835
- /**
836
- * Base Component.
837
- *
838
- * @export
839
- * @abstract
840
- * @class Component
841
- * @typedef {Component}
842
- */
843
- declare abstract class Component {
844
- abstract metadata: ComponentMetadata;
845
- /**
846
- * Execute the component.
847
- *
848
- * @abstract
849
- * @type {(client: TriviousClient, interaction: ComponentInteraction) => Promise<void>}
850
- */
851
- abstract execute: (client: TriviousClient, interaction: ComponentInteraction) => Promise<void>;
852
- /**
853
- * Validate permissions for a user/member in a guild.
854
- *
855
- * @async
856
- * @param {ComponentInteraction} interaction
857
- * @param {PermissionLevel} permission
858
- * @param {boolean} [doReply=true] Defaults to `true`
859
- * @returns {unknown}
860
- */
861
- validateGuildPermission(client: TriviousClient, interaction: ComponentInteraction, permission: PermissionLevel, doReply?: boolean): Promise<boolean>;
862
- /**
863
- * Reply to the interaction respecting command metadata and if the interaction has already been replied to.
864
- *
865
- * @async
866
- * @param {ComponentInteraction} interaction
867
- * @param {(MessagePayload | InteractionEditReplyOptions | InteractionReplyOptions)} options
868
- * @returns {*}
869
- */
870
- reply(interaction: ComponentInteraction, options: MessagePayload | InteractionEditReplyOptions | InteractionReplyOptions): Promise<void>;
871
- }
872
-
873
- /**
874
- * Registry to load and get all components.
875
- *
876
- * @export
877
- * @class ComponentRegistry
878
- * @typedef {ComponentRegistry}
879
- * @extends {BaseRegistry<Component>}
880
- */
881
- declare class ComponentRegistry extends BaseRegistry<Component> {
882
- protected items: Collection<string, Component>;
883
- /**
884
- * Load all components.
885
- *
886
- * @async
887
- * @param {string} [directory=getCorePath({ coreDirectory: "components" })]
888
- * @returns {Promise<this>}
889
- */
890
- load(directory?: string): Promise<this>;
891
- }
892
-
893
- /**
894
- * Registry to load and get all commands.
895
- *
896
- * @export
897
- * @class CommandRegistry
898
- * @typedef {CommandRegistry}
899
- * @extends {BaseRegistry<AnyCommand>}
900
- */
901
- declare class CommandRegistry extends BaseRegistry<AnyCommand> {
902
- protected items: Collection<string, AnyCommand>;
903
- /**
904
- * Load all commands and their subcommands
905
- *
906
- * @async
907
- * @param {string} [directory=getCorePath({ coreDirectory: "commands" })]
908
- * @returns {unknown}
909
- */
910
- load(directory?: string): Promise<this>;
911
- }
912
-
913
- /**
914
- * Trivious base client.
915
- *
916
- * @export
917
- * @class TriviousClient
918
- * @typedef {TriviousClient}
919
- * @extends {Client}
920
- */
921
- declare class TriviousClient extends Client {
922
- /**
923
- * Client registries.
924
- *
925
- * @public
926
- * @readonly
927
- * @type {*}
928
- */
929
- readonly registries: {
930
- commands: CommandRegistry;
931
- components: ComponentRegistry;
932
- events: EventRegistry;
933
- modules: ModuleRegistry;
934
- loadAll(options: TriviousClientOptions): Promise<void>;
935
- bind(client: TriviousClient): void;
936
- };
937
- /**
938
- * Client copy of the constructor options.
939
- *
940
- * @private
941
- * @type {TriviousClientOptions}
942
- */
943
- readonly _options: TriviousClientOptions;
944
- /**
945
- * Creates an instance of TriviousClient.
946
- *
947
- * @constructor
948
- * @param {TriviousClientOptions} options
949
- */
950
- constructor(options: TriviousClientOptions);
951
- /**
952
- * Load all registries.
953
- *
954
- * @async
955
- * @returns {*}
956
- */
957
- register(): Promise<void>;
958
- /**
959
- * Login and start the bot.
960
- *
961
- * @async
962
- * @returns {*}
963
- */
964
- start(): Promise<void>;
965
- /**
966
- * Deploy all commands.
967
- *
968
- * @async
969
- * @returns {*}
970
- */
971
- deploy(): Promise<void>;
972
- /**
973
- * Set the roles tied to a permission level.
974
- *
975
- * @param {Record<string, PermissionLevel>} roles
976
- */
977
- setRolePermissions(roles: Record<string, PermissionLevel>): void;
978
- get rolePermissions(): Record<string, PermissionLevel>;
979
- }
980
-
981
- type ChatInputCommandInteraction = ChatInputCommandInteraction$1<CacheType>;
982
- type ButtonInteraction = ButtonInteraction$1<CacheType>;
983
- type StringSelectMenuInteraction = StringSelectMenuInteraction$1<CacheType>;
984
- type ModalSubmitInteraction = ModalSubmitInteraction$1<CacheType>;
985
- type ContextMenuCommandInteraction = ContextMenuCommandInteraction$1<CacheType>;
986
-
987
- 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 };
1
+ import 'discord.js';
2
+ export { A as AnyCommand, B as ButtonInteraction, w as ChatInputCommandInteraction, i as Command, j 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, l as ContextMenuBuilder, k 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-BjPKCNAw.cjs';
3
+ export { BaseRegistry } from './shared/typings/registry.cjs';