trivious 1.3.21 → 1.3.23

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 +1443 -67
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +979 -3
  4. package/dist/index.d.ts +979 -3
  5. package/dist/index.js +1432 -10
  6. package/dist/index.js.map +1 -1
  7. package/package.json +1 -1
  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
@@ -1,927 +0,0 @@
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, ContextMenuCommandBuilder, SlashCommandBuilder, MessagePayload, InteractionEditReplyOptions, InteractionReplyOptions, Collection, SlashCommandSubcommandBuilder, ChatInputCommandInteraction as ChatInputCommandInteraction$1, ClientOptions, ClientEvents, ComponentType as ComponentType$1, Client, StringSelectMenuInteraction as StringSelectMenuInteraction$1, ContextMenuCommandInteraction as ContextMenuCommandInteraction$1 } from 'discord.js';
4
-
5
- /**
6
- * User permission level enums
7
- *
8
- * @export
9
- * @enum {number}
10
- */
11
- declare enum PermissionLevel {
12
- USER = 0,
13
- GUILD_STAFF = 1,
14
- GUILD_MODERATOR = 2,
15
- GUILD_ADMINISTRATOR = 3,
16
- GUILD_OWNER = 4,
17
- BOT_OWNER = 5
18
- }
19
- /**
20
- * Get the permission level of a user.
21
- *
22
- * @param {GuildMember} member
23
- * @returns {*}
24
- */
25
- declare const getPermissionLevel: (client: TriviousClient, member: GuildMember) => PermissionLevel;
26
-
27
- /**
28
- * Tags for component customIds.
29
- *
30
- * @export
31
- * @typedef {ComponentCustomIdTag}
32
- */
33
- type ComponentCustomIdTag = "awaited";
34
- /**
35
- * Interaction types for components.
36
- *
37
- * @export
38
- * @typedef {ComponentInteraction}
39
- */
40
- type ComponentInteraction = AnySelectMenuInteraction<CacheType> | ButtonInteraction$1<CacheType> | ModalSubmitInteraction$1<CacheType>;
41
- /**
42
- * What type of component is the componenty.
43
- *
44
- * @export
45
- * @enum {number}
46
- */
47
- declare enum ComponentType {
48
- Button = "button",
49
- SelectMenu = "select",
50
- Modal = "modal"
51
- }
52
- /**
53
- * Metadata for Components.
54
- *
55
- * @export
56
- * @interface ComponentMetadata
57
- * @typedef {ComponentMetadata}
58
- */
59
- interface ComponentMetadata {
60
- /**
61
- * The customId of the component.
62
- *
63
- * @type {string}
64
- */
65
- customId: string;
66
- /**
67
- * The permission level required to use the component.
68
- *
69
- * @type {PermissionLevel}
70
- */
71
- permission: PermissionLevel;
72
- /**
73
- * Whether the interaction reply is ephemeral.
74
- *
75
- * @type {boolean}
76
- */
77
- ephemeralReply: boolean;
78
- }
79
- /**
80
- * Deconstruct a component customId into its parts.
81
- *
82
- * @param {string} customId
83
- * @returns {{ componentType: ComponentType; data: string; tags: {}; }}
84
- */
85
- declare const deconstructCustomId: (customId: string) => {
86
- componentType: ComponentType;
87
- data: string;
88
- tags: "awaited"[];
89
- };
90
-
91
- /**
92
- * Base ContextMenuCommand.
93
- *
94
- * @export
95
- * @abstract
96
- * @class ContextMenuCommand
97
- * @typedef {ContextMenuCommand}
98
- * @extends {Command}
99
- */
100
- declare abstract class ContextMenuCommand extends Command {
101
- abstract data: ContextMenuCommandBuilder;
102
- abstract metadata: ContextMenuMetadata;
103
- /**
104
- * Function to run when the command is used.
105
- *
106
- * @abstract
107
- * @type {(
108
- * client: TriviousClient,
109
- * interaction: ContextMenuCommandInteraction
110
- * ) => Promise<void>}
111
- */
112
- abstract run: (client: TriviousClient, interaction: ContextMenuCommandInteraction) => Promise<void>;
113
- /**
114
- * Base command handler.
115
- *
116
- * @public
117
- * @async
118
- * @param {TriviousClient} client
119
- * @param {ContextMenuCommandInteraction} interaction
120
- * @returns {*}
121
- */
122
- execute(client: TriviousClient, interaction: ContextMenuCommandInteraction): Promise<void>;
123
- }
124
- /**
125
- * Base ContextMenuBuilder.
126
- *
127
- * @export
128
- * @class ContextMenuBuilder
129
- * @typedef {ContextMenuBuilder}
130
- * @extends {ContextMenuCommandBuilder}
131
- */
132
- declare class ContextMenuBuilder extends ContextMenuCommandBuilder {
133
- private _active;
134
- private _ownerOnly;
135
- private _permission;
136
- private _ephemeralReply;
137
- /**
138
- * Set the command as disabled.
139
- *
140
- * @public
141
- * @returns {this}
142
- */
143
- disable(): this;
144
- /**
145
- * Set the command as owner only.
146
- *
147
- * @public
148
- * @returns {this}
149
- */
150
- setOwnerOnly(): this;
151
- /**
152
- * Set the permission level required to run the command.
153
- *
154
- * @public
155
- * @param {PermissionLevel} permission
156
- * @returns {this}
157
- */
158
- setPermission(permission: PermissionLevel): this;
159
- /**
160
- * Set the interaction as ephemeral.
161
- *
162
- * @public
163
- * @returns {this}
164
- */
165
- setEphemeralReply(): this;
166
- /**
167
- * Build the builder
168
- *
169
- * @public
170
- * @returns {{ data: ContextMenuBuilder; metadata: ContextMenuMetadata; }}
171
- */
172
- build(): {
173
- data: ContextMenuBuilder;
174
- metadata: {
175
- active: boolean;
176
- ownerOnly: boolean;
177
- permission: PermissionLevel;
178
- ephemeralReply: boolean;
179
- };
180
- };
181
- }
182
-
183
- /**
184
- * Base class for a Command.
185
- *
186
- * @export
187
- * @abstract
188
- * @class Command
189
- * @typedef {Command}
190
- */
191
- declare abstract class Command {
192
- abstract data: SlashCommandBuilder | ContextMenuCommandBuilder;
193
- abstract metadata: CommandMetadata | ContextMenuMetadata;
194
- /**
195
- * Returns whether the command is a SlashCommand.
196
- *
197
- * @public
198
- * @param {Command} this
199
- * @returns {this is SlashCommand}
200
- */
201
- isSlashCommand(this: Command): this is SlashCommand;
202
- /**
203
- * Returns whether the command is a ContextMenuCommand.
204
- *
205
- * @public
206
- * @param {Command} this
207
- * @returns {this is ContextMenuCommand}
208
- */
209
- isContextMenuCommand(this: Command): this is ContextMenuCommand;
210
- /**
211
- * Returns JSON of the command builder.
212
- *
213
- * @public
214
- * @returns {*}
215
- */
216
- toJSON(): discord_js.RESTPostAPIChatInputApplicationCommandsJSONBody | discord_js.RESTPostAPIContextMenuApplicationCommandsJSONBody;
217
- /**
218
- * Reply to the interaction respecting command metadata and if the interaction has already been replied to.
219
- *
220
- * @public
221
- * @async
222
- * @param {CommandInteraction} interaction
223
- * @param {(MessagePayload | InteractionEditReplyOptions | InteractionReplyOptions)} options
224
- * @returns {*}
225
- */
226
- reply(interaction: CommandInteraction, options: MessagePayload | InteractionEditReplyOptions | InteractionReplyOptions): Promise<void>;
227
- /**
228
- * Validate permissions for a user/member in a guild.
229
- *
230
- * @async
231
- * @param {CommandInteraction} interaction
232
- * @param {PermissionLevel} permission
233
- * @param {boolean} [doReply=true]
234
- * @returns {unknown}
235
- */
236
- validateGuildPermission(client: TriviousClient, interaction: CommandInteraction, permission: PermissionLevel, doReply?: boolean): Promise<boolean>;
237
- }
238
- /**
239
- * Base SlashCommand.
240
- *
241
- * @export
242
- * @abstract
243
- * @class SlashCommand
244
- * @typedef {SlashCommand}
245
- * @extends {Command}
246
- */
247
- declare abstract class SlashCommand extends Command {
248
- abstract data: SlashCommandBuilder;
249
- abstract metadata: CommandMetadata;
250
- /**
251
- * Optional function to run if the SlashCommand has no subcommands or for extra fuctionality.
252
- *
253
- * @abstract
254
- * @type {?(
255
- * client: TriviousClient,
256
- * interaction: ChatInputCommandInteraction
257
- * ) => Promise<void>}
258
- */
259
- run?: (client: TriviousClient, interaction: ChatInputCommandInteraction) => Promise<void>;
260
- /**
261
- * General handler for the command and its subcommand, if applicable.
262
- *
263
- * @public
264
- * @async
265
- * @param {TriviousClient} client
266
- * @param {ChatInputCommandInteraction} interaction
267
- * @returns {*}
268
- */
269
- execute(client: TriviousClient, interaction: ChatInputCommandInteraction): Promise<void>;
270
- }
271
- /**
272
- * Base CommandBuilder.
273
- *
274
- * @export
275
- * @class CommandBuilder
276
- * @typedef {CommandBuilder}
277
- * @extends {SlashCommandBuilder}
278
- */
279
- declare class CommandBuilder extends SlashCommandBuilder {
280
- private _active;
281
- private _guildOnly;
282
- private _ownerOnly;
283
- private _permission;
284
- private _subcommands;
285
- private _ephemeralReply;
286
- /**
287
- * Set the command as disabled.
288
- *
289
- * @public
290
- * @returns {this}
291
- */
292
- disable(): this;
293
- /**
294
- * Set the command as guild only.
295
- *
296
- * @public
297
- * @returns {this}
298
- */
299
- setGuildOnly(): this;
300
- /**
301
- * Set the command as public only.
302
- *
303
- * @public
304
- * @returns {this}
305
- */
306
- setOwnerOnly(): this;
307
- /**
308
- * Set the permission level required to run the command.
309
- *
310
- * @public
311
- * @param {PermissionLevel} permission
312
- * @returns {this}
313
- */
314
- setPermission(permission: PermissionLevel): this;
315
- /**
316
- * Set the interaction as ephemeral.
317
- *
318
- * @public
319
- * @returns {this}
320
- */
321
- setEphemeralReply(): this;
322
- /**
323
- * Build the builder.
324
- *
325
- * @public
326
- * @returns {{ data: CommandBuilder; metadata: CommandMetadata; }}
327
- */
328
- build(): {
329
- data: CommandBuilder;
330
- metadata: {
331
- active: boolean;
332
- guildOnly: boolean;
333
- ownerOnly: boolean;
334
- permission: PermissionLevel;
335
- subcommands: Collection<string, Subcommand>;
336
- ephemeralReply: boolean;
337
- };
338
- };
339
- }
340
-
341
- /**
342
- * Base SubcommandBuilder.
343
- *
344
- * @export
345
- * @class SubcommandBuilder
346
- * @typedef {SubcommandBuilder}
347
- * @extends {SlashCommandSubcommandBuilder}
348
- */
349
- declare class SubcommandBuilder extends SlashCommandSubcommandBuilder {
350
- private _active;
351
- private _ownerOnly;
352
- private _permission;
353
- private _ephemeralReply;
354
- /**
355
- * Set the subcommand as disabled.
356
- *
357
- * @public
358
- * @returns {this}
359
- */
360
- disable(): this;
361
- /**
362
- * Set the subcommand as owner only.
363
- *
364
- * @public
365
- * @returns {this}
366
- */
367
- setOwnerOnly(): this;
368
- /**
369
- * Set the permission level required to run the subcommand.
370
- *
371
- * @public
372
- * @param {PermissionLevel} permission
373
- * @returns {this}
374
- */
375
- setPermission(permission: PermissionLevel): this;
376
- /**
377
- * Set the interaction as ephemeral
378
- *
379
- * @public
380
- * @returns {this}
381
- */
382
- setEphemeralReply(): this;
383
- /**
384
- * Build the builder.
385
- *
386
- * @public
387
- * @returns {{ data: SlashCommandSubcommandBuilder; metadata: SubcommandMetadata; }}
388
- */
389
- build(): {
390
- data: SlashCommandSubcommandBuilder;
391
- metadata: {
392
- active: boolean;
393
- ownerOnly: boolean;
394
- permission: PermissionLevel;
395
- ephemeralReply: boolean;
396
- };
397
- };
398
- }
399
- /**
400
- * Base Subcommand
401
- *
402
- * @export
403
- * @abstract
404
- * @class Subcommand
405
- * @typedef {Subcommand}
406
- */
407
- declare abstract class Subcommand {
408
- abstract data: SlashCommandSubcommandBuilder;
409
- abstract metadata: SubcommandMetadata;
410
- /**
411
- * Function to execute the subcommand.
412
- *
413
- * @abstract
414
- * @readonly
415
- * @type {(
416
- * client: TriviousClient,
417
- * interaction: ChatInputCommandInteraction<CacheType>
418
- * ) => Promise<void>}
419
- */
420
- abstract readonly execute: (client: TriviousClient, interaction: ChatInputCommandInteraction$1<CacheType>) => Promise<void>;
421
- /**
422
- * Reply to the interaction respecting command metadata and if the interaction has already been replied to.
423
- *
424
- * @async
425
- * @param {ChatInputCommandInteraction<CacheType>} interaction
426
- * @param {(MessagePayload | InteractionEditReplyOptions | InteractionReplyOptions)} options
427
- * @returns {*}
428
- */
429
- reply(interaction: ChatInputCommandInteraction$1<CacheType>, options: MessagePayload | InteractionEditReplyOptions | InteractionReplyOptions): Promise<void>;
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, SlashCommand as S, TriviousClient as T, ComponentRegistry as a, type TriviousClientOptions as b, type ComponentCustomIdTag as c, type ComponentInteraction as d, ComponentType as e, type ComponentMetadata as f, getPermissionLevel as g, deconstructCustomId as h, ContextMenuCommand as i, ContextMenuBuilder as j, Command as k, CommandBuilder as l, Subcommand as m, SubcommandBuilder as n, type CommandInteraction as o, type CommandMetadata as p, type SubcommandMetadata as q, type ContextMenuMetadata as r, type Event as s, type Module as t, Component as u, ComponentBuilder as v, type ChatInputCommandInteraction as w, type StringSelectMenuInteraction as x, type ModalSubmitInteraction as y, type ContextMenuCommandInteraction as z };