trivious 1.6.3 → 1.6.5

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.
@@ -1,4 +1,4 @@
1
- export { T as default } from '../../index-C2iWCQmv.js';
1
+ export { T as default } from '../../index-8sXvIzqQ.js';
2
2
  import 'discord.js';
3
3
  import '../../shared/typings/permissions.js';
4
4
  import '../../shared/typings/client.js';
@@ -1,44 +1,6 @@
1
- import { MessagePayload, InteractionEditReplyOptions, InteractionReplyOptions } from 'discord.js';
2
- import { C as Command, a as ChatInputCommandInteraction, b as ContextMenuCommandInteraction, T as TriviousClient, S as SlashCommand } from '../../index-C2iWCQmv.js';
3
- import { PermissionLevel } from '../../shared/typings/permissions.js';
1
+ import 'discord.js';
2
+ export { o as commandReply, p as handleSlashCommand, v as verifyGuildPermission } from '../../index-8sXvIzqQ.js';
3
+ import '../../shared/typings/permissions.js';
4
4
  import '../../shared/typings/registry.js';
5
5
  import '../../shared/typings/client.js';
6
6
  import '../builders/util.builders.js';
7
-
8
- /**
9
- * Reply to a command, respecting whether it has been deferred or already replied to.
10
- *
11
- * @export
12
- * @async
13
- * @param {Command} command
14
- * @param {ChatInputCommandInteraction | ContextMenuCommandInteraction} interaction
15
- * @param {(MessagePayload | InteractionEditReplyOptions | InteractionReplyOptions)} options
16
- * @returns {*}
17
- */
18
- declare function commandReply(command: Command, interaction: ChatInputCommandInteraction | ContextMenuCommandInteraction, options: MessagePayload | InteractionEditReplyOptions | InteractionReplyOptions): Promise<void>;
19
- /**
20
- * Compare a permission level to the guild member's permission level.
21
- *
22
- * @export
23
- * @async
24
- * @param {TriviousClient} client
25
- * @param {ChatInputCommandInteraction | ContextMenuCommandInteraction} interaction
26
- * @param {Command} command
27
- * @param {PermissionLevel} requiredPermission
28
- * @param {boolean} [doReply=true]
29
- * @returns {unknown}
30
- */
31
- declare function verifyGuildPermission(client: TriviousClient, interaction: ChatInputCommandInteraction | ContextMenuCommandInteraction, command: Command, requiredPermission: PermissionLevel, doReply?: boolean): Promise<boolean>;
32
- /**
33
- * Handle execution of a slash command.
34
- *
35
- * @export
36
- * @async
37
- * @param {TriviousClient} client
38
- * @param {(SlashCommand | SlashSubcommand)} command
39
- * @param {ChatInputCommandInteraction} interaction
40
- * @returns {*}
41
- */
42
- declare function handleSlashCommand(client: TriviousClient, command: SlashCommand, interaction: ChatInputCommandInteraction): Promise<void>;
43
-
44
- export { commandReply, handleSlashCommand, verifyGuildPermission };
@@ -1,5 +1,5 @@
1
1
  import * as discord_js from 'discord.js';
2
- import { T as TriviousClient } from '../../index-C2iWCQmv.js';
2
+ import { T as TriviousClient } from '../../index-8sXvIzqQ.js';
3
3
  import '../../shared/typings/permissions.js';
4
4
  import '../../shared/typings/registry.js';
5
5
  import '../../shared/typings/client.js';
@@ -1,6 +1,6 @@
1
1
  import * as discord_js from 'discord.js';
2
2
  import { CacheType } from 'discord.js';
3
- import { T as TriviousClient } from '../../index-C2iWCQmv.js';
3
+ import { T as TriviousClient } from '../../index-8sXvIzqQ.js';
4
4
  import '../../shared/typings/permissions.js';
5
5
  import '../../shared/typings/registry.js';
6
6
  import '../../shared/typings/client.js';
@@ -34,12 +34,6 @@ var interactionCreate_default = {
34
34
  requiredPermission || PermissionLevel.USER
35
35
  );
36
36
  if (!hasPermission2) return;
37
- if (!("execute" in command)) {
38
- await commandReply(command, interaction, {
39
- content: "Command does not have a way to execute! Ensure the command is a SlashCommand or ContextMenuCommand!"
40
- });
41
- return;
42
- }
43
37
  if (command.flags?.includes("DeferReply")) {
44
38
  await commandReply(command, interaction, { content: "Processing command..." });
45
39
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/events/interactionCreate.ts"],"names":["hasPermission"],"mappings":";;;;;;AA0BA,eAAe,gCAAA,CACd,MAAA,EACA,WAAA,EACA,UAAA,EACC;AACD,EAAA,IAAI,YAAY,KAAA,EAAO;AACtB,IAAA,MAAM,SAAS,WAAA,CAAY,MAAA;AAC3B,IAAA,MAAM,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AA,QACA;AAAA,OACD;AACA,MAAA,IAAI,CAACA,cAAAA,EAAe;AAEpB,MAAA,IAAI,CAAC,WAAA,CAAY,aAAA,EAAc,EAAG,MAAM,YAAY,WAAA,EAAY;AAChE,MAAA,MAAM,SAAA,CAAU,OAAA,CAAQ,MAAA,EAAQ,WAAW,CAAA;AAAA,IAC5C;AAAA,EACD;AACD","file":"interactionCreate.js","sourcesContent":["import {\n\tButtonInteraction,\n\tCacheType,\n\tGuildMember,\n\tMessageContextMenuCommandInteraction,\n\tModalSubmitInteraction,\n\tUserContextMenuCommandInteraction,\n} from \"discord.js\";\nimport {\n\tComponentInteraction,\n\tComponentType,\n\tContextMenuCommand,\n\tEvent,\n\tPermissionLevel,\n\tSlashCommand,\n} from \"src/shared/typings/index.js\";\nimport { hasPermission } from \"src/shared/utility/functions.js\";\nimport {\n\tcommandReply,\n\thandleSlashCommand,\n\tverifyGuildPermission,\n} from \"../commands/methods.command.js\";\nimport { ChatInputCommandInteraction } from \"src/index.js\";\nimport { deconstructCustomId } from \"src/shared/utility/components.utility.js\";\nimport TriviousClient from \"../client/trivious.client.js\";\n\nasync function validateComponentGuildPermission(\n\tclient: TriviousClient,\n\tinteraction: ComponentInteraction,\n\tpermission: PermissionLevel\n) {\n\tif (interaction.guild) {\n\t\tconst member = interaction.member as GuildMember;\n\t\tconst memberHasPermission = hasPermission(client, { permission, member });\n\t\treturn memberHasPermission;\n\t}\n\n\treturn false;\n}\n\nexport default {\n\tname: \"interactionCreate\",\n\texecute: async (client, interaction) => {\n\t\tif (interaction.isChatInputCommand() || interaction.isContextMenuCommand()) {\n\t\t\tconst { commandName } = interaction;\n\n\t\t\tconst registeredCommands = client.registries.commands.get();\n\t\t\tconst command = registeredCommands.get(commandName);\n\t\t\tif (!command) {\n\t\t\t\tawait interaction.reply({\n\t\t\t\t\tcontent: `Command is outdated, inactive or does not have a handler!`,\n\t\t\t\t\tflags: [\"Ephemeral\"],\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst requiredPermission = command.permission;\n\t\t\tconst hasPermission = await verifyGuildPermission(\n\t\t\t\tclient,\n\t\t\t\tinteraction,\n\t\t\t\tcommand,\n\t\t\t\trequiredPermission || PermissionLevel.USER\n\t\t\t);\n\t\t\tif (!hasPermission) return;\n\n\t\t\tif (!(\"execute\" in command)) {\n\t\t\t\tawait commandReply(command, interaction, {\n\t\t\t\t\tcontent:\n\t\t\t\t\t\t\"Command does not have a way to execute! Ensure the command is a SlashCommand or ContextMenuCommand!\",\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (command.flags?.includes(\"DeferReply\")) {\n\t\t\t\tawait commandReply(command, interaction, { content: \"Processing command...\" });\n\t\t\t}\n\n\t\t\tif (command.context === \"SlashCommand\" && \"data\" in command) {\n\t\t\t\tawait handleSlashCommand(\n\t\t\t\t\tclient,\n\t\t\t\t\tcommand as SlashCommand,\n\t\t\t\t\tinteraction as ChatInputCommandInteraction\n\t\t\t\t);\n\t\t\t} else if (command.context === \"ContextMenu\") {\n\t\t\t\tawait (command as ContextMenuCommand).execute(\n\t\t\t\t\tclient,\n\t\t\t\t\tinteraction as\n\t\t\t\t\t\t| UserContextMenuCommandInteraction<CacheType>\n\t\t\t\t\t\t| MessageContextMenuCommandInteraction<CacheType>\n\t\t\t\t);\n\t\t\t}\n\t\t} else if (interaction.isMessageComponent() || interaction.isModalSubmit()) {\n\t\t\tconst { compType, tags, data } = deconstructCustomId(interaction.customId);\n\n\t\t\tif (compType === ComponentType.Button && !(interaction instanceof ButtonInteraction)) return;\n\t\t\tif (compType === ComponentType.Modal && !(interaction instanceof ModalSubmitInteraction))\n\t\t\t\treturn;\n\n\t\t\tif (tags && tags.includes(\"awaited\")) return;\n\n\t\t\tconst registeredComponents = client.registries.components.get();\n\t\t\tconst component = registeredComponents.get(data);\n\t\t\tif (!component) {\n\t\t\t\tawait interaction.reply({\n\t\t\t\t\tcontent: `Command is outdated, inactive or does not have a handler!`,\n\t\t\t\t\tflags: [\"Ephemeral\"],\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst requiredPermission = component.permission;\n\t\t\tconst hasPermission = await validateComponentGuildPermission(\n\t\t\t\tclient,\n\t\t\t\tinteraction,\n\t\t\t\trequiredPermission\n\t\t\t);\n\t\t\tif (!hasPermission) return;\n\n\t\t\tif (!interaction.isModalSubmit()) await interaction.deferUpdate();\n\t\t\tawait component.execute(client, interaction);\n\t\t}\n\t},\n} satisfies Event<\"interactionCreate\">;\n"]}
1
+ {"version":3,"sources":["../../../src/core/events/interactionCreate.ts"],"names":["hasPermission"],"mappings":";;;;;;AA0BA,eAAe,gCAAA,CACd,MAAA,EACA,WAAA,EACA,UAAA,EACC;AACD,EAAA,IAAI,YAAY,KAAA,EAAO;AACtB,IAAA,MAAM,SAAS,WAAA,CAAY,MAAA;AAC3B,IAAA,MAAM,sBAAsB,aAAA,CAAc,MAAA,EAAQ,EAAE,UAAA,EAAY,QAAQ,CAAA;AACxE,IAAA,OAAO,mBAAA;AAAA,EACR;AAEA,EAAA,OAAO,KAAA;AACR;AAEA,IAAO,yBAAA,GAAQ;AAAA,EACd,IAAA,EAAM,mBAAA;AAAA,EACN,OAAA,EAAS,OAAO,MAAA,EAAQ,WAAA,KAAgB;AACvC,IAAA,IAAI,WAAA,CAAY,kBAAA,EAAmB,IAAK,WAAA,CAAY,sBAAqB,EAAG;AAC3E,MAAA,MAAM,EAAE,aAAY,GAAI,WAAA;AAExB,MAAA,MAAM,kBAAA,GAAqB,MAAA,CAAO,UAAA,CAAW,QAAA,CAAS,GAAA,EAAI;AAC1D,MAAA,MAAM,OAAA,GAAU,kBAAA,CAAmB,GAAA,CAAI,WAAW,CAAA;AAClD,MAAA,IAAI,CAAC,OAAA,EAAS;AACb,QAAA,MAAM,YAAY,KAAA,CAAM;AAAA,UACvB,OAAA,EAAS,CAAA,yDAAA,CAAA;AAAA,UACT,KAAA,EAAO,CAAC,WAAW;AAAA,SACnB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AAW,GAAA,EAAI;AAC9D,MAAA,MAAM,SAAA,GAAY,oBAAA,CAAqB,GAAA,CAAI,IAAI,CAAA;AAC/C,MAAA,IAAI,CAAC,SAAA,EAAW;AACf,QAAA,MAAM,YAAY,KAAA,CAAM;AAAA,UACvB,OAAA,EAAS,CAAA,yDAAA,CAAA;AAAA,UACT,KAAA,EAAO,CAAC,WAAW;AAAA,SACnB,CAAA;AACD,QAAA;AAAA,MACD;AAEA,MAAA,MAAM,qBAAqB,SAAA,CAAU,UAAA;AACrC,MAAA,MAAMA,iBAAgB,MAAM,gCAAA;AAAA,QAC3B,MAAA;AAAA,QACA,WAAA;AAAA,QACA;AAAA,OACD;AACA,MAAA,IAAI,CAACA,cAAAA,EAAe;AAEpB,MAAA,IAAI,CAAC,WAAA,CAAY,aAAA,EAAc,EAAG,MAAM,YAAY,WAAA,EAAY;AAChE,MAAA,MAAM,SAAA,CAAU,OAAA,CAAQ,MAAA,EAAQ,WAAW,CAAA;AAAA,IAC5C;AAAA,EACD;AACD","file":"interactionCreate.js","sourcesContent":["import {\n\tButtonInteraction,\n\tCacheType,\n\tGuildMember,\n\tMessageContextMenuCommandInteraction,\n\tModalSubmitInteraction,\n\tUserContextMenuCommandInteraction,\n} from \"discord.js\";\nimport {\n\tComponentInteraction,\n\tComponentType,\n\tContextMenuCommand,\n\tEvent,\n\tPermissionLevel,\n\tSlashCommand,\n} from \"src/shared/typings/index.js\";\nimport { hasPermission } from \"src/shared/utility/functions.js\";\nimport {\n\tcommandReply,\n\thandleSlashCommand,\n\tverifyGuildPermission,\n} from \"../commands/methods.command.js\";\nimport { ChatInputCommandInteraction } from \"src/index.js\";\nimport { deconstructCustomId } from \"src/shared/utility/components.utility.js\";\nimport TriviousClient from \"../client/trivious.client.js\";\n\nasync function validateComponentGuildPermission(\n\tclient: TriviousClient,\n\tinteraction: ComponentInteraction,\n\tpermission: PermissionLevel\n) {\n\tif (interaction.guild) {\n\t\tconst member = interaction.member as GuildMember;\n\t\tconst memberHasPermission = hasPermission(client, { permission, member });\n\t\treturn memberHasPermission;\n\t}\n\n\treturn false;\n}\n\nexport default {\n\tname: \"interactionCreate\",\n\texecute: async (client, interaction) => {\n\t\tif (interaction.isChatInputCommand() || interaction.isContextMenuCommand()) {\n\t\t\tconst { commandName } = interaction;\n\n\t\t\tconst registeredCommands = client.registries.commands.get();\n\t\t\tconst command = registeredCommands.get(commandName);\n\t\t\tif (!command) {\n\t\t\t\tawait interaction.reply({\n\t\t\t\t\tcontent: `Command is outdated, inactive or does not have a handler!`,\n\t\t\t\t\tflags: [\"Ephemeral\"],\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst requiredPermission = command.permission;\n\t\t\tconst hasPermission = await verifyGuildPermission(\n\t\t\t\tclient,\n\t\t\t\tinteraction,\n\t\t\t\tcommand,\n\t\t\t\trequiredPermission || PermissionLevel.USER\n\t\t\t);\n\t\t\tif (!hasPermission) return;\n\n\t\t\tif (command.flags?.includes(\"DeferReply\")) {\n\t\t\t\tawait commandReply(command, interaction, { content: \"Processing command...\" });\n\t\t\t}\n\n\t\t\tif (command.context === \"SlashCommand\" && \"data\" in command) {\n\t\t\t\tawait handleSlashCommand(\n\t\t\t\t\tclient,\n\t\t\t\t\tcommand as SlashCommand,\n\t\t\t\t\tinteraction as ChatInputCommandInteraction\n\t\t\t\t);\n\t\t\t} else if (command.context === \"ContextMenu\") {\n\t\t\t\tawait (command as ContextMenuCommand).execute(\n\t\t\t\t\tclient,\n\t\t\t\t\tinteraction as\n\t\t\t\t\t\t| UserContextMenuCommandInteraction<CacheType>\n\t\t\t\t\t\t| MessageContextMenuCommandInteraction<CacheType>\n\t\t\t\t);\n\t\t\t}\n\t\t} else if (interaction.isMessageComponent() || interaction.isModalSubmit()) {\n\t\t\tconst { compType, tags, data } = deconstructCustomId(interaction.customId);\n\n\t\t\tif (compType === ComponentType.Button && !(interaction instanceof ButtonInteraction)) return;\n\t\t\tif (compType === ComponentType.Modal && !(interaction instanceof ModalSubmitInteraction))\n\t\t\t\treturn;\n\n\t\t\tif (tags && tags.includes(\"awaited\")) return;\n\n\t\t\tconst registeredComponents = client.registries.components.get();\n\t\t\tconst component = registeredComponents.get(data);\n\t\t\tif (!component) {\n\t\t\t\tawait interaction.reply({\n\t\t\t\t\tcontent: `Command is outdated, inactive or does not have a handler!`,\n\t\t\t\t\tflags: [\"Ephemeral\"],\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst requiredPermission = component.permission;\n\t\t\tconst hasPermission = await validateComponentGuildPermission(\n\t\t\t\tclient,\n\t\t\t\tinteraction,\n\t\t\t\trequiredPermission\n\t\t\t);\n\t\t\tif (!hasPermission) return;\n\n\t\t\tif (!interaction.isModalSubmit()) await interaction.deferUpdate();\n\t\t\tawait component.execute(client, interaction);\n\t\t}\n\t},\n} satisfies Event<\"interactionCreate\">;\n"]}
@@ -1,6 +1,6 @@
1
1
  import 'discord.js';
2
2
  import '../../shared/typings/registry.js';
3
- export { c as default } from '../../index-C2iWCQmv.js';
3
+ export { C as default } from '../../index-8sXvIzqQ.js';
4
4
  import '../../shared/typings/permissions.js';
5
5
  import '../../shared/typings/client.js';
6
6
  import '../builders/util.builders.js';
@@ -1,6 +1,6 @@
1
1
  import 'discord.js';
2
2
  import '../../shared/typings/registry.js';
3
- export { d as default } from '../../index-C2iWCQmv.js';
3
+ export { a as default } from '../../index-8sXvIzqQ.js';
4
4
  import '../../shared/typings/permissions.js';
5
5
  import '../../shared/typings/client.js';
6
6
  import '../builders/util.builders.js';
@@ -1,6 +1,6 @@
1
1
  import 'discord.js';
2
2
  import '../../shared/typings/registry.js';
3
- export { E as default } from '../../index-C2iWCQmv.js';
3
+ export { E as default } from '../../index-8sXvIzqQ.js';
4
4
  import '../../shared/typings/permissions.js';
5
5
  import '../../shared/typings/client.js';
6
6
  import '../builders/util.builders.js';
@@ -1,5 +1,5 @@
1
1
  import { TriviousClientOptions } from '../../shared/typings/client.js';
2
- import { c as CommandRegistry, d as ComponentRegistry, E as EventRegistry, M as ModuleRegistry, T as TriviousClient } from '../../index-C2iWCQmv.js';
2
+ import { C as CommandRegistry, a as ComponentRegistry, E as EventRegistry, M as ModuleRegistry, T as TriviousClient } from '../../index-8sXvIzqQ.js';
3
3
  import 'discord.js';
4
4
  import '../../shared/typings/permissions.js';
5
5
  import '../../shared/typings/registry.js';
@@ -1,6 +1,6 @@
1
1
  import 'discord.js';
2
2
  import '../../shared/typings/registry.js';
3
- export { M as default } from '../../index-C2iWCQmv.js';
3
+ export { M as default } from '../../index-8sXvIzqQ.js';
4
4
  import '../../shared/typings/permissions.js';
5
5
  import '../../shared/typings/client.js';
6
6
  import '../builders/util.builders.js';
@@ -1,7 +1,7 @@
1
1
  import { PermissionLevel } from './shared/typings/permissions.js';
2
2
  import { BaseRegistry } from './shared/typings/registry.js';
3
3
  import { TriviousClientOptions } from './shared/typings/client.js';
4
- import { AnySelectMenuInteraction, CacheType, ButtonInteraction as ButtonInteraction$1, ModalSubmitInteraction as ModalSubmitInteraction$1, SlashCommandBuilder, Collection, SlashCommandSubcommandBuilder, ContextMenuCommandBuilder, MessageContextMenuCommandInteraction, UserContextMenuCommandInteraction, ClientEvents, Client, ChatInputCommandInteraction as ChatInputCommandInteraction$1, StringSelectMenuInteraction as StringSelectMenuInteraction$1, ContextMenuCommandInteraction as ContextMenuCommandInteraction$1 } from 'discord.js';
4
+ import { AnySelectMenuInteraction, CacheType, ButtonInteraction as ButtonInteraction$1, ModalSubmitInteraction as ModalSubmitInteraction$1, SlashCommandBuilder, Collection, SlashCommandSubcommandBuilder, ContextMenuCommandBuilder, MessageContextMenuCommandInteraction, UserContextMenuCommandInteraction, ClientEvents, Client, MessagePayload, InteractionEditReplyOptions, InteractionReplyOptions, ChatInputCommandInteraction as ChatInputCommandInteraction$1, StringSelectMenuInteraction as StringSelectMenuInteraction$1, ContextMenuCommandInteraction as ContextMenuCommandInteraction$1 } from 'discord.js';
5
5
  import './core/builders/util.builders.js';
6
6
 
7
7
  /**
@@ -367,10 +367,46 @@ declare class TriviousClient extends Client {
367
367
  get rolePermissions(): Record<string, PermissionLevel>;
368
368
  }
369
369
 
370
+ /**
371
+ * Reply to a command, respecting whether it has been deferred or already replied to.
372
+ *
373
+ * @export
374
+ * @async
375
+ * @param {Command} command
376
+ * @param {ChatInputCommandInteraction | ContextMenuCommandInteraction} interaction
377
+ * @param {(MessagePayload | InteractionEditReplyOptions | InteractionReplyOptions)} options
378
+ * @returns {*}
379
+ */
380
+ declare function commandReply(command: Command, interaction: ChatInputCommandInteraction | ContextMenuCommandInteraction, options: MessagePayload | InteractionEditReplyOptions | InteractionReplyOptions): Promise<void>;
381
+ /**
382
+ * Compare a permission level to the guild member's permission level.
383
+ *
384
+ * @export
385
+ * @async
386
+ * @param {TriviousClient} client
387
+ * @param {ChatInputCommandInteraction | ContextMenuCommandInteraction} interaction
388
+ * @param {Command} command
389
+ * @param {PermissionLevel} requiredPermission
390
+ * @param {boolean} [doReply=true]
391
+ * @returns {unknown}
392
+ */
393
+ declare function verifyGuildPermission(client: TriviousClient, interaction: ChatInputCommandInteraction | ContextMenuCommandInteraction, command: Command, requiredPermission: PermissionLevel, doReply?: boolean): Promise<boolean>;
394
+ /**
395
+ * Handle execution of a slash command.
396
+ *
397
+ * @export
398
+ * @async
399
+ * @param {TriviousClient} client
400
+ * @param {(SlashCommand | SlashSubcommand)} command
401
+ * @param {ChatInputCommandInteraction} interaction
402
+ * @returns {*}
403
+ */
404
+ declare function handleSlashCommand(client: TriviousClient, command: SlashCommand, interaction: ChatInputCommandInteraction): Promise<void>;
405
+
370
406
  type ChatInputCommandInteraction = ChatInputCommandInteraction$1<CacheType>;
371
407
  type ButtonInteraction = ButtonInteraction$1<CacheType>;
372
408
  type StringSelectMenuInteraction = StringSelectMenuInteraction$1<CacheType>;
373
409
  type ModalSubmitInteraction = ModalSubmitInteraction$1<CacheType>;
374
410
  type ContextMenuCommandInteraction = ContextMenuCommandInteraction$1<CacheType>;
375
411
 
376
- export { type ButtonInteraction as B, type Command as C, EventRegistry as E, ModuleRegistry as M, type SlashCommand as S, TriviousClient as T, type ChatInputCommandInteraction as a, type ContextMenuCommandInteraction as b, CommandRegistry as c, ComponentRegistry as d, type CustomIdConstructOptions as e, type Component as f, type ComponentCustomIdTag as g, type ComponentInteraction as h, ComponentType as i, type SlashSubcommand as j, type ContextMenuCommand as k, type CommandInteraction as l, type CommandFlags as m, type CommandContext as n, type Event as o, type Module as p, type StringSelectMenuInteraction as q, type ModalSubmitInteraction as r };
412
+ export { type ButtonInteraction as B, CommandRegistry as C, EventRegistry as E, ModuleRegistry as M, type SlashCommand as S, TriviousClient as T, ComponentRegistry as a, type CustomIdConstructOptions as b, type Component as c, type ComponentCustomIdTag as d, type ComponentInteraction as e, ComponentType as f, type Command as g, type SlashSubcommand as h, type ContextMenuCommand as i, type CommandInteraction as j, type CommandFlags as k, type CommandContext as l, type Event as m, type Module as n, commandReply as o, handleSlashCommand as p, type ChatInputCommandInteraction as q, type StringSelectMenuInteraction as r, type ModalSubmitInteraction as s, type ContextMenuCommandInteraction as t, verifyGuildPermission as v };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import 'discord.js';
2
- export { B as ButtonInteraction, a as ChatInputCommandInteraction, C as Command, n as CommandContext, m as CommandFlags, l as CommandInteraction, c as CommandRegistry, f as Component, g as ComponentCustomIdTag, h as ComponentInteraction, d as ComponentRegistry, i as ComponentType, k as ContextMenuCommand, b as ContextMenuCommandInteraction, e as CustomIdConstructOptions, o as Event, r as ModalSubmitInteraction, p as Module, S as SlashCommand, j as SlashSubcommand, q as StringSelectMenuInteraction, T as TriviousClient } from './index-C2iWCQmv.js';
2
+ export { B as ButtonInteraction, q as ChatInputCommandInteraction, g as Command, l as CommandContext, k as CommandFlags, j as CommandInteraction, C as CommandRegistry, c as Component, d as ComponentCustomIdTag, e as ComponentInteraction, a as ComponentRegistry, f as ComponentType, i as ContextMenuCommand, t as ContextMenuCommandInteraction, b as CustomIdConstructOptions, m as Event, s as ModalSubmitInteraction, n as Module, S as SlashCommand, h as SlashSubcommand, r as StringSelectMenuInteraction, T as TriviousClient, o as commandReply, p as handleSlashCommand, v as verifyGuildPermission } from './index-8sXvIzqQ.js';
3
3
  export { createActionRow, createEmbed } from './core/builders/util.builders.js';
4
4
  export { PermissionLevel } from './shared/typings/permissions.js';
5
5
  export { BaseRegistry } from './shared/typings/registry.js';
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@ import 'dotenv/config';
2
2
  import 'node:util';
3
3
  export { default as TriviousClient } from './core/client/trivious.client.js';
4
4
  export { default as CommandRegistry } from './core/registry/command.registry.js';
5
+ export { commandReply, handleSlashCommand, verifyGuildPermission } from './core/commands/methods.command.js';
5
6
  export { default as ComponentRegistry } from './core/registry/component.registry.js';
6
7
  export { createActionRow, createEmbed } from './core/builders/util.builders.js';
7
8
  export * from './shared/typings/index.js';
@@ -1,6 +1,6 @@
1
1
  import './permissions.js';
2
2
  import 'discord.js';
3
- export { C as Command, n as CommandContext, m as CommandFlags, l as CommandInteraction, k as ContextMenuCommand, S as SlashCommand, j as SlashSubcommand } from '../../index-C2iWCQmv.js';
3
+ export { g as Command, l as CommandContext, k as CommandFlags, j as CommandInteraction, i as ContextMenuCommand, S as SlashCommand, h as SlashSubcommand } from '../../index-8sXvIzqQ.js';
4
4
  import './registry.js';
5
5
  import './client.js';
6
6
  import '../../core/builders/util.builders.js';
@@ -1,6 +1,6 @@
1
1
  import 'discord.js';
2
2
  import './permissions.js';
3
- export { f as Component, g as ComponentCustomIdTag, h as ComponentInteraction, i as ComponentType, e as CustomIdConstructOptions } from '../../index-C2iWCQmv.js';
3
+ export { c as Component, d as ComponentCustomIdTag, e as ComponentInteraction, f as ComponentType, b as CustomIdConstructOptions } from '../../index-8sXvIzqQ.js';
4
4
  import './registry.js';
5
5
  import './client.js';
6
6
  import '../../core/builders/util.builders.js';
@@ -1,5 +1,5 @@
1
1
  import 'discord.js';
2
- export { o as Event } from '../../index-C2iWCQmv.js';
2
+ export { m as Event } from '../../index-8sXvIzqQ.js';
3
3
  import './permissions.js';
4
4
  import './registry.js';
5
5
  import './client.js';
@@ -1,6 +1,6 @@
1
1
  export { PermissionLevel } from './permissions.js';
2
2
  export { BaseRegistry } from './registry.js';
3
- export { C as Command, n as CommandContext, m as CommandFlags, l as CommandInteraction, f as Component, g as ComponentCustomIdTag, h as ComponentInteraction, i as ComponentType, k as ContextMenuCommand, e as CustomIdConstructOptions, o as Event, p as Module, S as SlashCommand, j as SlashSubcommand } from '../../index-C2iWCQmv.js';
3
+ export { g as Command, l as CommandContext, k as CommandFlags, j as CommandInteraction, c as Component, d as ComponentCustomIdTag, e as ComponentInteraction, f as ComponentType, i as ContextMenuCommand, b as CustomIdConstructOptions, m as Event, n as Module, S as SlashCommand, h as SlashSubcommand } from '../../index-8sXvIzqQ.js';
4
4
  export { TriviousClientOptions } from './client.js';
5
5
  import 'discord.js';
6
6
  import '../../core/builders/util.builders.js';
@@ -1,5 +1,5 @@
1
1
  import 'discord.js';
2
- export { p as Module } from '../../index-C2iWCQmv.js';
2
+ export { n as Module } from '../../index-8sXvIzqQ.js';
3
3
  import './permissions.js';
4
4
  import './registry.js';
5
5
  import './client.js';
@@ -1,4 +1,4 @@
1
- import { e as CustomIdConstructOptions } from '../../index-C2iWCQmv.js';
1
+ import { b as CustomIdConstructOptions } from '../../index-8sXvIzqQ.js';
2
2
  import '../typings/permissions.js';
3
3
  import '../typings/registry.js';
4
4
  import 'discord.js';
@@ -1,4 +1,4 @@
1
- import { T as TriviousClient } from '../../index-C2iWCQmv.js';
1
+ import { T as TriviousClient } from '../../index-8sXvIzqQ.js';
2
2
  import { PermissionLevel } from '../typings/permissions.js';
3
3
  import { User, GuildMember, RESTPostAPIApplicationCommandsJSONBody } from 'discord.js';
4
4
  import '../typings/registry.js';
@@ -1,6 +1,6 @@
1
1
  import { GuildMember } from 'discord.js';
2
2
  import { PermissionLevel } from '../typings/permissions.js';
3
- import { T as TriviousClient } from '../../index-C2iWCQmv.js';
3
+ import { T as TriviousClient } from '../../index-8sXvIzqQ.js';
4
4
  import '../typings/registry.js';
5
5
  import '../typings/client.js';
6
6
  import '../../core/builders/util.builders.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trivious",
3
- "version": "1.6.3",
3
+ "version": "1.6.5",
4
4
  "type": "module",
5
5
  "keywords": [
6
6
  "discord-bot",