trivious 2.0.4 → 2.0.6

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 (27) hide show
  1. package/dist/features/client/deploy.client.d.ts +1 -1
  2. package/dist/features/client/trivious.client.d.ts +1 -1
  3. package/dist/features/commands/commands.types.d.ts +1 -1
  4. package/dist/features/commands/methods.commands.d.ts +1 -1
  5. package/dist/features/commands/registry.commands.d.ts +1 -1
  6. package/dist/features/commands/registry.commands.js +2 -1
  7. package/dist/features/commands/registry.commands.js.map +1 -1
  8. package/dist/features/components/components.types.d.ts +1 -1
  9. package/dist/features/components/registry.components.d.ts +1 -1
  10. package/dist/features/customId/customid.types.d.ts +1 -1
  11. package/dist/features/customId/methods.customid.d.ts +12 -15
  12. package/dist/features/customId/methods.customid.js +27 -18
  13. package/dist/features/customId/methods.customid.js.map +1 -1
  14. package/dist/features/events/events.types.d.ts +1 -1
  15. package/dist/features/events/presets/clientReady.d.ts +1 -1
  16. package/dist/features/events/presets/interactionCreate.d.ts +1 -1
  17. package/dist/features/events/presets/interactionCreate.js +3 -3
  18. package/dist/features/events/presets/interactionCreate.js.map +1 -1
  19. package/dist/features/events/registry.events.d.ts +1 -1
  20. package/dist/features/modules/modules.types.d.ts +1 -1
  21. package/dist/features/modules/registry.modules.d.ts +1 -1
  22. package/dist/index.d.ts +1 -2
  23. package/dist/{modules.types-uNvWKT4j.d.ts → modules.types-Czzl6XR9.d.ts} +2 -2
  24. package/dist/shared/registries.d.ts +1 -1
  25. package/dist/shared/typings.d.ts +1 -1
  26. package/dist/utility/errors.d.ts +1 -1
  27. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { T as TriviousClient } from '../../modules.types-uNvWKT4j.js';
1
+ import { T as TriviousClient } from '../../modules.types-Czzl6XR9.js';
2
2
  import 'discord.js';
3
3
  import './client.types.js';
4
4
 
@@ -1,3 +1,3 @@
1
1
  import 'discord.js';
2
2
  import './client.types.js';
3
- export { T as default } from '../../modules.types-uNvWKT4j.js';
3
+ export { T as default } from '../../modules.types-Czzl6XR9.js';
@@ -1,3 +1,3 @@
1
1
  import 'discord.js';
2
- export { B as BaseChatInputCommandData, a as BaseCommandData, b as BaseContextCommandData, C as ChatInputCommandContext, c as CommandFlags, d as CommandFunction, i as ContextCommandData, M as MessageCommandData, S as SlashCommandData, k as SlashSubcommandData, l as SlashSubcommandGroupData, U as UserCommandData } from '../../modules.types-uNvWKT4j.js';
2
+ export { B as BaseChatInputCommandData, a as BaseCommandData, b as BaseContextCommandData, C as ChatInputCommandContext, c as CommandFlags, d as CommandFunction, i as ContextCommandData, M as MessageCommandData, S as SlashCommandData, k as SlashSubcommandData, l as SlashSubcommandGroupData, U as UserCommandData } from '../../modules.types-Czzl6XR9.js';
3
3
  import '../client/client.types.js';
@@ -1,6 +1,6 @@
1
1
  import * as discord_js from 'discord.js';
2
2
  import { ChatInputCommandInteraction, Interaction, CacheType, InteractionReplyOptions, InteractionEditReplyOptions, MessagePayload } from 'discord.js';
3
- import { T as TriviousClient, S as SlashCommandData, c as CommandFlags } from '../../modules.types-uNvWKT4j.js';
3
+ import { T as TriviousClient, S as SlashCommandData, c as CommandFlags } from '../../modules.types-Czzl6XR9.js';
4
4
  import '../client/client.types.js';
5
5
 
6
6
  declare function interactionReply(options: {
@@ -1,4 +1,4 @@
1
- import { T as TriviousClient } from '../../modules.types-uNvWKT4j.js';
1
+ import { T as TriviousClient } from '../../modules.types-Czzl6XR9.js';
2
2
  import 'discord.js';
3
3
  import '../client/client.types.js';
4
4
 
@@ -34,7 +34,8 @@ async function parseSlashCommand(file, parentDir, subdirectories) {
34
34
  const indexFile = path.resolve(subdir.parentPath, subdir.name, "index.js");
35
35
  if (!existsSync(indexFile)) continue;
36
36
  const group = await importFile(indexFile);
37
- if (!group || !("context" in group) || group.context !== "SlashSubcommandGroup") continue;
37
+ if (!group || !("context" in group && "addSubcommandGroup" in command.data) || group.context !== "SlashSubcommandGroup")
38
+ continue;
38
39
  group.parent = command;
39
40
  if (!command.subcommandGroups) command.subcommandGroups = new Collection();
40
41
  await parseSlashSubcommands(join(subdir.parentPath, subdir.name), group);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/features/commands/registry.commands.ts"],"names":["fs"],"mappings":";;;;;;AAgBA,SAAS,eAAA,CACR,SACA,OAAA,EACU;AACV,EAAA,IAAI,EAAE,QAAA,IAAY,OAAA,IAAW,aAAA,IAAiB,UAAU,OAAO,KAAA;AAC/D,EAAA,IAAI,CAAC,OAAA,CAAQ,MAAA,EAAQ,OAAO,KAAA;AAC5B,EAAA,OAAO,QAAQ,OAAO,CAAA;AACvB;AAEA,eAAe,qBAAA,CACd,WACA,IAAA,EACC;AAED,EAAA,MAAM,WAAA,GAAc,IAAI,UAAA,EAAkE;AAE1F,EAAA,IAAI,EAAE,eAAA,IAAmB,IAAA,CAAK,IAAA,CAAA,EAAO,OAAO,WAAA;AAE5C,EAAA,MAAM,QAAQA,QAAA,CAAG,IAAA,CAAK,IAAA,CAAK,SAAA,EAAW,QAAQ,CAAC,CAAA;AAC/C,EAAA,WAAA,MAAiB,QAAQ,KAAA,EAAO;AAC/B,IAAA,MAAM,UAAA,GAAa,MAAM,UAAA,CAA0D,IAAI,CAAA;AACvF,IAAA,IACC,CAAC,cACD,CAAC,eAAA,CAAgB,YAAY,CAAC,MAAA,KAAW,MAAA,CAAO,OAAA,KAAY,iBAAiB,CAAA;AAE7E,MAAA;AAED,IAAA,UAAA,CAAW,MAAA,GAAS,IAAA;AACpB,IAAA,IAAA,CAAK,IAAA,CAAK,aAAA,CAAc,UAAA,CAAW,IAAI,CAAA;AACvC,IAAA,WAAA,CAAY,GAAA,CAAI,UAAA,CAAW,IAAA,CAAK,IAAA,EAAM,UAAU,CAAA;AAAA,EACjD;AAEA,EAAA,IAAI,WAAA,CAAY,IAAA,GAAO,CAAA,EAAG,IAAA,CAAK,WAAA,GAAc,WAAA;AAC7C,EAAA,OAAO,WAAA;AACR;AAEA,eAAe,iBAA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AAA,MAAM,eAAA,GAAkB,MAAM,oBAAA,CAAqB,SAAS,CAAA;AAC5D,EAAA,eAAA,CAAgB,OAAA,CAAQ,CAAC,GAAA,KAAQ,MAAA,CAAO,MAAA,CAAO,QAAA,CAAS,OAAA,CAAQ,GAAA,CAAI,GAAA,CAAI,IAAA,CAAK,IAAA,EAAM,GAAG,CAAC,CAAA;AACxF;AAEA,eAAO,gBAAA,CAAwC,QAAwB,SAAA,EAAmB;AACzF,EAAA,IAAI,CAAC,WAAW,SAAS,CAAA;AACxB,IAAA,MAAM,IAAI,aAAA;AAAA,MACT,kDAAkD,SAAS,CAAA,iBAAA,CAAA;AAAA,MAC3D;AAAA,KACD;AAED,EAAA,MAAM,oBAAA,uBAA2B,GAAA,EAAY;AAE7C,EAAA,MAAM,QAAQA,QAAA,CAAG,IAAA,CAAK,IAAA,CAAK,SAAA,EAAW,SAAS,CAAC,CAAA;AAChD,EAAA,WAAA,MAAiB,QAAQ,KAAA,EAAO;AAC/B,IAAA,MAAM,SAAA,GAAY,IAAA,CAAK,OAAA,CAAQ,IAAI,CAAA;AAEnC,IAAA,IAAI,oBAAA,CAAqB,GAAA,CAAI,SAAS,CAAA,EAAG;AACzC,IAAA,oBAAA,CAAqB,IAAI,SAAS,CAAA;AAElC,IAAA,MAAM,iBAAA,CAAkB,QAAQ,SAAS,CAAA;AAAA,EAC1C;AACD","file":"registry.commands.js","sourcesContent":["import {\n\tBaseChatInputCommandData,\n\tBaseContextCommandData,\n\tMessageCommandData,\n\tSlashCommandData,\n\tSlashSubcommandData,\n\tSlashSubcommandGroupData,\n\tTriviousClient,\n\tUserCommandData,\n} from \"#typings\";\nimport { TriviousError } from \"#utility/errors.js\";\nimport { importFile } from \"#utility/functions.js\";\nimport { ApplicationCommandType, Collection } from \"discord.js\";\nimport { Dirent, existsSync, promises as fs } from \"fs\";\nimport path, { join } from \"path\";\n\nfunction validateCommand<T extends BaseChatInputCommandData | BaseContextCommandData>(\n\tcommand: T,\n\texpects: (command: Partial<T>) => boolean\n): boolean {\n\tif (!(\"active\" in command && \"commandType\" in command)) return false;\n\tif (!command.active) return false;\n\treturn expects(command);\n}\n\nasync function parseSlashSubcommands(\n\tdirectory: string,\n\tdata: SlashCommandData | SlashSubcommandGroupData<boolean>\n) {\n\tconst _parentType = \"context\" in data ? \"command\" : \"group\";\n\tconst subcommands = new Collection<string, SlashSubcommandData<true, typeof _parentType>>();\n\n\tif (!(\"addSubcommand\" in data.data)) return subcommands;\n\n\tconst files = fs.glob(join(directory, \"./*.js\"));\n\tfor await (const file of files) {\n\t\tconst subcommand = await importFile<SlashSubcommandData<true, typeof _parentType>>(file);\n\t\tif (\n\t\t\t!subcommand ||\n\t\t\t!validateCommand(subcommand, (subcmd) => subcmd.context === \"SlashSubcommand\")\n\t\t)\n\t\t\tcontinue;\n\n\t\tsubcommand.parent = data;\n\t\tdata.data.addSubcommand(subcommand.data);\n\t\tsubcommands.set(subcommand.data.name, subcommand);\n\t}\n\n\tif (subcommands.size > 0) data.subcommands = subcommands;\n\treturn subcommands;\n}\n\nasync function parseSlashCommand(\n\tfile: string,\n\tparentDir: string,\n\tsubdirectories: Dirent<string>[]\n) {\n\tif (!existsSync(file)) return;\n\n\tconst command = await importFile<SlashCommandData>(file);\n\tif (\n\t\t!command ||\n\t\t!validateCommand(command, (cmd) => cmd.context === \"SlashCommand\") ||\n\t\t!(\"addSubcommand\" in command.data)\n\t)\n\t\treturn;\n\n\tawait parseSlashSubcommands(parentDir, command);\n\n\tfor (const subdir of subdirectories) {\n\t\tconst indexFile = path.resolve(subdir.parentPath, subdir.name, \"index.js\");\n\t\tif (!existsSync(indexFile)) continue;\n\n\t\tconst group = await importFile<SlashSubcommandGroupData<true>>(indexFile);\n\t\tif (!group || !(\"context\" in group) || group.context !== \"SlashSubcommandGroup\") continue;\n\n\t\tgroup.parent = command;\n\t\tif (!command.subcommandGroups) command.subcommandGroups = new Collection();\n\t\tawait parseSlashSubcommands(join(subdir.parentPath, subdir.name), group);\n\n\t\tif (group.subcommands.size > 0) {\n\t\t\tcommand.data.addSubcommandGroup(group.data);\n\t\t\tcommand.subcommandGroups.set(group.data.name, group);\n\t\t}\n\t}\n\n\treturn command;\n}\n\nasync function parseContextCommands(parentDir: string) {\n\tconst collection = new Collection<string, MessageCommandData | UserCommandData>();\n\tconst files = fs.glob(join(parentDir, \"**/*.js\"));\n\tfor await (const file of files) {\n\t\tconst contextCommand = await importFile<MessageCommandData | UserCommandData>(file);\n\t\tif (\n\t\t\t!contextCommand ||\n\t\t\t!validateCommand(\n\t\t\t\tcontextCommand,\n\t\t\t\t(cmd) =>\n\t\t\t\t\tcmd.commandType === ApplicationCommandType.Message ||\n\t\t\t\t\tcmd.commandType === ApplicationCommandType.User\n\t\t\t)\n\t\t)\n\t\t\tcontinue;\n\n\t\tcontextCommand.data.setType(contextCommand.commandType);\n\t\tcollection.set(contextCommand.data.name, contextCommand);\n\t}\n\n\treturn collection;\n}\n\nasync function registerDirectory(client: TriviousClient, parentDir: string) {\n\tconst entries = await fs.readdir(parentDir, { withFileTypes: true });\n\tconst subdirectories = entries.filter((entry) => entry.isDirectory());\n\n\tconst indexFile = path.resolve(parentDir, \"index.js\");\n\tconst slashCommand = await parseSlashCommand(indexFile, parentDir, subdirectories);\n\tif (slashCommand) client.stores.commands.chatInput.set(slashCommand.data.name, slashCommand);\n\n\tconst contextCommands = await parseContextCommands(parentDir);\n\tcontextCommands.forEach((cmd) => client.stores.commands.context.set(cmd.data.name, cmd));\n}\n\nexport default async function registerCommands(client: TriviousClient, directory: string) {\n\tif (!existsSync(directory))\n\t\tthrow new TriviousError(\n\t\t\t`Could not register commands; passed directory '${directory}' does not exist!`,\n\t\t\t\"Nonexistant directory passed\"\n\t\t);\n\n\tconst processedDirectories = new Set<string>();\n\n\tconst files = fs.glob(join(directory, \"**/*.js\"));\n\tfor await (const file of files) {\n\t\tconst parentDir = path.dirname(file);\n\n\t\tif (processedDirectories.has(parentDir)) continue;\n\t\tprocessedDirectories.add(parentDir);\n\n\t\tawait registerDirectory(client, parentDir);\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/features/commands/registry.commands.ts"],"names":["fs"],"mappings":";;;;;;AAgBA,SAAS,eAAA,CACR,SACA,OAAA,EACU;AACV,EAAA,IAAI,EAAE,QAAA,IAAY,OAAA,IAAW,aAAA,IAAiB,UAAU,OAAO,KAAA;AAC/D,EAAA,IAAI,CAAC,OAAA,CAAQ,MAAA,EAAQ,OAAO,KAAA;AAC5B,EAAA,OAAO,QAAQ,OAAO,CAAA;AACvB;AAEA,eAAe,qBAAA,CACd,WACA,IAAA,EACC;AAED,EAAA,MAAM,WAAA,GAAc,IAAI,UAAA,EAAkE;AAE1F,EAAA,IAAI,EAAE,eAAA,IAAmB,IAAA,CAAK,IAAA,CAAA,EAAO,OAAO,WAAA;AAE5C,EAAA,MAAM,QAAQA,QAAA,CAAG,IAAA,CAAK,IAAA,CAAK,SAAA,EAAW,QAAQ,CAAC,CAAA;AAC/C,EAAA,WAAA,MAAiB,QAAQ,KAAA,EAAO;AAC/B,IAAA,MAAM,UAAA,GAAa,MAAM,UAAA,CAA0D,IAAI,CAAA;AACvF,IAAA,IACC,CAAC,cACD,CAAC,eAAA,CAAgB,YAAY,CAAC,MAAA,KAAW,MAAA,CAAO,OAAA,KAAY,iBAAiB,CAAA;AAE7E,MAAA;AAED,IAAA,UAAA,CAAW,MAAA,GAAS,IAAA;AACpB,IAAA,IAAA,CAAK,IAAA,CAAK,aAAA,CAAc,UAAA,CAAW,IAAI,CAAA;AACvC,IAAA,WAAA,CAAY,GAAA,CAAI,UAAA,CAAW,IAAA,CAAK,IAAA,EAAM,UAAU,CAAA;AAAA,EACjD;AAEA,EAAA,IAAI,WAAA,CAAY,IAAA,GAAO,CAAA,EAAG,IAAA,CAAK,WAAA,GAAc,WAAA;AAC7C,EAAA,OAAO,WAAA;AACR;AAEA,eAAe,iBAAA,CACd,IAAA,EACA,SAAA,EACA,cAAA,EACC;AACD,EAAA,IAAI,CAAC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B,MAAM,oBAAA,CAAqB,SAAS,CAAA;AAC5D,EAAA,eAAA,CAAgB,OAAA,CAAQ,CAAC,GAAA,KAAQ,MAAA,CAAO,MAAA,CAAO,QAAA,CAAS,OAAA,CAAQ,GAAA,CAAI,GAAA,CAAI,IAAA,CAAK,IAAA,EAAM,GAAG,CAAC,CAAA;AACxF;AAEA,eAAO,gBAAA,CAAwC,QAAwB,SAAA,EAAmB;AACzF,EAAA,IAAI,CAAC,WAAW,SAAS,CAAA;AACxB,IAAA,MAAM,IAAI,aAAA;AAAA,MACT,kDAAkD,SAAS,CAAA,iBAAA,CAAA;AAAA,MAC3D;AAAA,KACD;AAED,EAAA,MAAM,oBAAA,uBAA2B,GAAA,EAAY;AAE7C,EAAA,MAAM,QAAQA,QAAA,CAAG,IAAA,CAAK,IAAA,CAAK,SAAA,EAAW,SAAS,CAAC,CAAA;AAChD,EAAA,WAAA,MAAiB,QAAQ,KAAA,EAAO;AAC/B,IAAA,MAAM,SAAA,GAAY,IAAA,CAAK,OAAA,CAAQ,IAAI,CAAA;AAEnC,IAAA,IAAI,oBAAA,CAAqB,GAAA,CAAI,SAAS,CAAA,EAAG;AACzC,IAAA,oBAAA,CAAqB,IAAI,SAAS,CAAA;AAElC,IAAA,MAAM,iBAAA,CAAkB,QAAQ,SAAS,CAAA;AAAA,EAC1C;AACD","file":"registry.commands.js","sourcesContent":["import {\n\tBaseChatInputCommandData,\n\tBaseContextCommandData,\n\tMessageCommandData,\n\tSlashCommandData,\n\tSlashSubcommandData,\n\tSlashSubcommandGroupData,\n\tTriviousClient,\n\tUserCommandData,\n} from \"#typings\";\nimport { TriviousError } from \"#utility/errors.js\";\nimport { importFile } from \"#utility/functions.js\";\nimport { ApplicationCommandType, Collection, SlashCommandBuilder } from \"discord.js\";\nimport { Dirent, existsSync, promises as fs } from \"fs\";\nimport path, { join } from \"path\";\n\nfunction validateCommand<T extends BaseChatInputCommandData | BaseContextCommandData>(\n\tcommand: T,\n\texpects: (command: Partial<T>) => boolean\n): boolean {\n\tif (!(\"active\" in command && \"commandType\" in command)) return false;\n\tif (!command.active) return false;\n\treturn expects(command);\n}\n\nasync function parseSlashSubcommands(\n\tdirectory: string,\n\tdata: SlashCommandData | SlashSubcommandGroupData<boolean>\n) {\n\tconst _parentType = \"context\" in data ? \"command\" : \"group\";\n\tconst subcommands = new Collection<string, SlashSubcommandData<true, typeof _parentType>>();\n\n\tif (!(\"addSubcommand\" in data.data)) return subcommands;\n\n\tconst files = fs.glob(join(directory, \"./*.js\"));\n\tfor await (const file of files) {\n\t\tconst subcommand = await importFile<SlashSubcommandData<true, typeof _parentType>>(file);\n\t\tif (\n\t\t\t!subcommand ||\n\t\t\t!validateCommand(subcommand, (subcmd) => subcmd.context === \"SlashSubcommand\")\n\t\t)\n\t\t\tcontinue;\n\n\t\tsubcommand.parent = data;\n\t\tdata.data.addSubcommand(subcommand.data);\n\t\tsubcommands.set(subcommand.data.name, subcommand);\n\t}\n\n\tif (subcommands.size > 0) data.subcommands = subcommands;\n\treturn subcommands;\n}\n\nasync function parseSlashCommand(\n\tfile: string,\n\tparentDir: string,\n\tsubdirectories: Dirent<string>[]\n) {\n\tif (!existsSync(file)) return;\n\n\tconst command = await importFile<SlashCommandData>(file);\n\tif (\n\t\t!command ||\n\t\t!validateCommand(command, (cmd) => cmd.context === \"SlashCommand\") ||\n\t\t!(\"addSubcommand\" in command.data)\n\t)\n\t\treturn;\n\n\tawait parseSlashSubcommands(parentDir, command);\n\n\tfor (const subdir of subdirectories) {\n\t\tconst indexFile = path.resolve(subdir.parentPath, subdir.name, \"index.js\");\n\t\tif (!existsSync(indexFile)) continue;\n\n\t\tconst group = await importFile<SlashSubcommandGroupData<true>>(indexFile);\n\t\tif (\n\t\t\t!group ||\n\t\t\t!(\"context\" in group && \"addSubcommandGroup\" in command.data) ||\n\t\t\tgroup.context !== \"SlashSubcommandGroup\"\n\t\t)\n\t\t\tcontinue;\n\n\t\tgroup.parent = command;\n\t\tif (!command.subcommandGroups) command.subcommandGroups = new Collection();\n\t\tawait parseSlashSubcommands(join(subdir.parentPath, subdir.name), group);\n\n\t\tif (group.subcommands.size > 0) {\n\t\t\t(command.data as SlashCommandBuilder).addSubcommandGroup(group.data);\n\t\t\tcommand.subcommandGroups.set(group.data.name, group);\n\t\t}\n\t}\n\n\treturn command;\n}\n\nasync function parseContextCommands(parentDir: string) {\n\tconst collection = new Collection<string, MessageCommandData | UserCommandData>();\n\tconst files = fs.glob(join(parentDir, \"**/*.js\"));\n\tfor await (const file of files) {\n\t\tconst contextCommand = await importFile<MessageCommandData | UserCommandData>(file);\n\t\tif (\n\t\t\t!contextCommand ||\n\t\t\t!validateCommand(\n\t\t\t\tcontextCommand,\n\t\t\t\t(cmd) =>\n\t\t\t\t\tcmd.commandType === ApplicationCommandType.Message ||\n\t\t\t\t\tcmd.commandType === ApplicationCommandType.User\n\t\t\t)\n\t\t)\n\t\t\tcontinue;\n\n\t\tcontextCommand.data.setType(contextCommand.commandType);\n\t\tcollection.set(contextCommand.data.name, contextCommand);\n\t}\n\n\treturn collection;\n}\n\nasync function registerDirectory(client: TriviousClient, parentDir: string) {\n\tconst entries = await fs.readdir(parentDir, { withFileTypes: true });\n\tconst subdirectories = entries.filter((entry) => entry.isDirectory());\n\n\tconst indexFile = path.resolve(parentDir, \"index.js\");\n\tconst slashCommand = await parseSlashCommand(indexFile, parentDir, subdirectories);\n\tif (slashCommand) client.stores.commands.chatInput.set(slashCommand.data.name, slashCommand);\n\n\tconst contextCommands = await parseContextCommands(parentDir);\n\tcontextCommands.forEach((cmd) => client.stores.commands.context.set(cmd.data.name, cmd));\n}\n\nexport default async function registerCommands(client: TriviousClient, directory: string) {\n\tif (!existsSync(directory))\n\t\tthrow new TriviousError(\n\t\t\t`Could not register commands; passed directory '${directory}' does not exist!`,\n\t\t\t\"Nonexistant directory passed\"\n\t\t);\n\n\tconst processedDirectories = new Set<string>();\n\n\tconst files = fs.glob(join(directory, \"**/*.js\"));\n\tfor await (const file of files) {\n\t\tconst parentDir = path.dirname(file);\n\n\t\tif (processedDirectories.has(parentDir)) continue;\n\t\tprocessedDirectories.add(parentDir);\n\n\t\tawait registerDirectory(client, parentDir);\n\t}\n}\n"]}
@@ -1,3 +1,3 @@
1
1
  import 'discord.js';
2
- export { e as Component, f as ComponentContext, g as ComponentFlags, h as ComponentInteraction } from '../../modules.types-uNvWKT4j.js';
2
+ export { e as Component, f as ComponentContext, g as ComponentFlags, h as ComponentInteraction } from '../../modules.types-Czzl6XR9.js';
3
3
  import '../client/client.types.js';
@@ -1,4 +1,4 @@
1
- import { T as TriviousClient } from '../../modules.types-uNvWKT4j.js';
1
+ import { T as TriviousClient } from '../../modules.types-Czzl6XR9.js';
2
2
  import 'discord.js';
3
3
  import '../client/client.types.js';
4
4
 
@@ -1,5 +1,5 @@
1
1
  import '../client/client.types.js';
2
- import { f as ComponentContext } from '../../modules.types-uNvWKT4j.js';
2
+ import { f as ComponentContext } from '../../modules.types-Czzl6XR9.js';
3
3
  import 'discord.js';
4
4
 
5
5
  type ComponentTag = "awaited";
@@ -1,20 +1,17 @@
1
1
  import { ComponentCustomId } from './customid.types.js';
2
2
  import '../client/client.types.js';
3
3
  import 'discord.js';
4
- import '../../modules.types-uNvWKT4j.js';
4
+ import '../../modules.types-Czzl6XR9.js';
5
5
 
6
- /**
7
- * Decode a customId into its parts
8
- * @param customId The custom id
9
- * @returns Decoded customId
10
- */
11
- declare const decodeCustomId: (customId: string) => ComponentCustomId;
12
- /**
13
- * Encode a customId
14
- * @param options Custom id parts
15
- * @returns Encoded customId
16
- * @throws {TriviousError} If encoded length exceeds 100 characters
17
- */
18
- declare const encodeCustomId: (options: ComponentCustomId) => string;
6
+ declare const customId: {
7
+ /**
8
+ * Decode a customId into its parts
9
+ */
10
+ readonly decode: (customId: string) => ComponentCustomId;
11
+ /**
12
+ * Encode a customId
13
+ */
14
+ readonly encode: (options: ComponentCustomId) => string;
15
+ };
19
16
 
20
- export { decodeCustomId, encodeCustomId };
17
+ export { customId as default };
@@ -1,24 +1,33 @@
1
1
  import { TriviousError } from '../../utility/errors.js';
2
2
 
3
- const decodeCustomId = (customId) => {
4
- const [context, identifier, info] = customId.split(":");
5
- const [data, ...tags] = info?.split(".");
6
- return {
7
- context,
8
- identifier,
9
- data,
10
- tags
11
- };
12
- };
13
- const encodeCustomId = (options) => {
14
- const { context, identifier, data, tags } = options;
15
- let customId = `${context}:${identifier}`;
16
- if (data) customId += `:${data}`;
17
- if (tags) customId += `.${tags.join(".")}`;
18
- if (customId.length > 100) throw new TriviousError("Encoded customId exceeds 100 characters.");
19
- return customId;
3
+ const customId = {
4
+ /**
5
+ * Decode a customId into its parts
6
+ */
7
+ decode: (customId2) => {
8
+ const [context, identifier, info] = customId2.split(":");
9
+ const [data, ...tags] = info?.split(".");
10
+ return {
11
+ context,
12
+ identifier,
13
+ data,
14
+ tags
15
+ };
16
+ },
17
+ /**
18
+ * Encode a customId
19
+ */
20
+ encode: (options) => {
21
+ const { context, identifier, data, tags } = options;
22
+ let customId2 = `${context}:${identifier}`;
23
+ if (data) customId2 += `:${data}`;
24
+ if (tags) customId2 += `.${tags.join(".")}`;
25
+ if (customId2.length > 100) throw new TriviousError("Encoded customId exceeds 100 characters.");
26
+ return customId2;
27
+ }
20
28
  };
29
+ var methods_customid_default = customId;
21
30
 
22
- export { decodeCustomId, encodeCustomId };
31
+ export { methods_customid_default as default };
23
32
  //# sourceMappingURL=methods.customid.js.map
24
33
  //# sourceMappingURL=methods.customid.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/features/customId/methods.customid.ts"],"names":[],"mappings":";;AAQO,MAAM,cAAA,GAAiB,CAAC,QAAA,KAAqB;AACnD,EAAA,MAAM,CAAC,OAAA,EAAS,UAAA,EAAY,IAAI,CAAA,GAAI,QAAA,CAAS,MAAM,GAAG,CAAA;AAKtD,EAAA,MAAM,CAAC,IAAA,EAAM,GAAG,IAAI,CAAA,GAAI,IAAA,EAAM,MAAM,GAAG,CAAA;AAEvC,EAAA,OAAO;AAAA,IACN,OAAA;AAAA,IACA,UAAA;AAAA,IACA,IAAA;AAAA,IACA;AAAA,GACD;AACD;AAQO,MAAM,cAAA,GAAiB,CAAC,OAAA,KAA+B;AAC7D,EAAA,MAAM,EAAE,OAAA,EAAS,UAAA,EAAY,IAAA,EAAM,MAAK,GAAI,OAAA;AAC5C,EAAA,IAAI,QAAA,GAAW,CAAA,EAAG,OAAO,CAAA,CAAA,EAAI,UAAU,CAAA,CAAA;AAEvC,EAAA,IAAI,IAAA,EAAM,QAAA,IAAY,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA;AAC9B,EAAA,IAAI,MAAM,QAAA,IAAY,CAAA,CAAA,EAAI,IAAA,CAAK,IAAA,CAAK,GAAG,CAAC,CAAA,CAAA;AAExC,EAAA,IAAI,SAAS,MAAA,GAAS,GAAA,EAAK,MAAM,IAAI,cAAc,0CAA0C,CAAA;AAC7F,EAAA,OAAO,QAAA;AACR","file":"methods.customid.js","sourcesContent":["import { ComponentContext, ComponentCustomId, ComponentTag } from \"#typings\";\nimport { TriviousError } from \"#utility/errors.js\";\n\n/**\n * Decode a customId into its parts\n * @param customId The custom id\n * @returns Decoded customId\n */\nexport const decodeCustomId = (customId: string) => {\n\tconst [context, identifier, info] = customId.split(\":\") as [\n\t\tComponentContext,\n\t\tstring,\n\t\tstring | undefined,\n\t];\n\tconst [data, ...tags] = info?.split(\".\") as [string | undefined, ...ComponentTag[]];\n\n\treturn {\n\t\tcontext,\n\t\tidentifier,\n\t\tdata,\n\t\ttags,\n\t} as ComponentCustomId;\n};\n\n/**\n * Encode a customId\n * @param options Custom id parts\n * @returns Encoded customId\n * @throws {TriviousError} If encoded length exceeds 100 characters\n */\nexport const encodeCustomId = (options: ComponentCustomId) => {\n\tconst { context, identifier, data, tags } = options;\n\tlet customId = `${context}:${identifier}`;\n\n\tif (data) customId += `:${data}`;\n\tif (tags) customId += `.${tags.join(\".\")}`;\n\n\tif (customId.length > 100) throw new TriviousError(\"Encoded customId exceeds 100 characters.\");\n\treturn customId;\n};\n"]}
1
+ {"version":3,"sources":["../../../src/features/customId/methods.customid.ts"],"names":["customId"],"mappings":";;AAGA,MAAM,QAAA,GAAW;AAAA;AAAA;AAAA;AAAA,EAIhB,MAAA,EAAQ,CAACA,SAAAA,KAAqB;AAC7B,IAAA,MAAM,CAAC,OAAA,EAAS,UAAA,EAAY,IAAI,CAAA,GAAIA,SAAAA,CAAS,MAAM,GAAG,CAAA;AAKtD,IAAA,MAAM,CAAC,IAAA,EAAM,GAAG,IAAI,CAAA,GAAI,IAAA,EAAM,MAAM,GAAG,CAAA;AAEvC,IAAA,OAAO;AAAA,MACN,OAAA;AAAA,MACA,UAAA;AAAA,MACA,IAAA;AAAA,MACA;AAAA,KACD;AAAA,EACD,CAAA;AAAA;AAAA;AAAA;AAAA,EAIA,MAAA,EAAQ,CAAC,OAAA,KAA+B;AACvC,IAAA,MAAM,EAAE,OAAA,EAAS,UAAA,EAAY,IAAA,EAAM,MAAK,GAAI,OAAA;AAC5C,IAAA,IAAIA,SAAAA,GAAW,CAAA,EAAG,OAAO,CAAA,CAAA,EAAI,UAAU,CAAA,CAAA;AAEvC,IAAA,IAAI,IAAA,EAAMA,SAAAA,IAAY,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA;AAC9B,IAAA,IAAI,MAAMA,SAAAA,IAAY,IAAI,IAAA,CAAK,IAAA,CAAK,GAAG,CAAC,CAAA,CAAA;AAExC,IAAA,IAAIA,UAAS,MAAA,GAAS,GAAA,EAAK,MAAM,IAAI,cAAc,0CAA0C,CAAA;AAC7F,IAAA,OAAOA,SAAAA;AAAA,EACR;AACD,CAAA;AAEA,IAAO,wBAAA,GAAQ","file":"methods.customid.js","sourcesContent":["import { ComponentContext, ComponentCustomId, ComponentTag } from \"#typings\";\nimport { TriviousError } from \"#utility/errors.js\";\n\nconst customId = {\n\t/**\n\t * Decode a customId into its parts\n\t */\n\tdecode: (customId: string) => {\n\t\tconst [context, identifier, info] = customId.split(\":\") as [\n\t\t\tComponentContext,\n\t\t\tstring,\n\t\t\tstring | undefined,\n\t\t];\n\t\tconst [data, ...tags] = info?.split(\".\") as [string | undefined, ...ComponentTag[]];\n\n\t\treturn {\n\t\t\tcontext,\n\t\t\tidentifier,\n\t\t\tdata,\n\t\t\ttags,\n\t\t} as ComponentCustomId;\n\t},\n\t/**\n\t * Encode a customId\n\t */\n\tencode: (options: ComponentCustomId) => {\n\t\tconst { context, identifier, data, tags } = options;\n\t\tlet customId = `${context}:${identifier}`;\n\n\t\tif (data) customId += `:${data}`;\n\t\tif (tags) customId += `.${tags.join(\".\")}`;\n\n\t\tif (customId.length > 100) throw new TriviousError(\"Encoded customId exceeds 100 characters.\");\n\t\treturn customId;\n\t},\n} as const;\n\nexport default customId;\n"]}
@@ -1,3 +1,3 @@
1
1
  import 'discord.js';
2
- export { E as Event } from '../../modules.types-uNvWKT4j.js';
2
+ export { E as Event } from '../../modules.types-Czzl6XR9.js';
3
3
  import '../client/client.types.js';
@@ -1,4 +1,4 @@
1
- import { T as TriviousClient } from '../../../modules.types-uNvWKT4j.js';
1
+ import { T as TriviousClient } from '../../../modules.types-Czzl6XR9.js';
2
2
  import 'discord.js';
3
3
  import '../../client/client.types.js';
4
4
 
@@ -1,5 +1,5 @@
1
1
  import * as discord_js from 'discord.js';
2
- import { T as TriviousClient } from '../../../modules.types-uNvWKT4j.js';
2
+ import { T as TriviousClient } from '../../../modules.types-Czzl6XR9.js';
3
3
  import '../../client/client.types.js';
4
4
 
5
5
  declare const _default: {
@@ -1,7 +1,7 @@
1
+ import { ComponentContext } from '../../../shared/typings.js';
1
2
  import { ApplicationCommandType, ButtonInteraction, ModalSubmitInteraction } from 'discord.js';
2
3
  import { interactionReply, handleSlashCommand } from '../../../features/commands/methods.commands.js';
3
- import { decodeCustomId } from '../../../features/customId/methods.customid.js';
4
- import { ComponentContext } from '../../../shared/typings.js';
4
+ import customId from '../../../features/customId/methods.customid.js';
5
5
 
6
6
  var interactionCreate_default = {
7
7
  name: "interactionCreate",
@@ -24,7 +24,7 @@ var interactionCreate_default = {
24
24
  await command.execute(client, interaction);
25
25
  }
26
26
  } else if (interaction.isMessageComponent() || interaction.isModalSubmit()) {
27
- const { context, identifier, tags } = decodeCustomId(interaction.customId);
27
+ const { context, identifier, tags } = customId.decode(interaction.customId);
28
28
  if (context === ComponentContext.Button && !(interaction instanceof ButtonInteraction))
29
29
  return;
30
30
  if (context === ComponentContext.Modal && !(interaction instanceof ModalSubmitInteraction))
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/features/events/presets/interactionCreate.ts"],"names":[],"mappings":";;;;;AAKA,IAAO,yBAAA,GAAQ;AAAA,EACd,IAAA,EAAM,mBAAA;AAAA,EACN,MAAM,OAAA,CAAQ,MAAA,EAAQ,WAAA,EAAa;AAClC,IAAA,IAAI,WAAA,CAAY,kBAAA,EAAmB,IAAK,WAAA,CAAY,sBAAqB,EAAG;AAC3E,MAAA,MAAM,EAAE,aAAY,GAAI,WAAA;AAExB,MAAA,MAAM,YAAA,GAAe,WAAA,CAAY,kBAAA,EAAmB,GACjD,MAAA,CAAO,OAAO,QAAA,CAAS,SAAA,GACvB,MAAA,CAAO,MAAA,CAAO,QAAA,CAAS,OAAA;AAC1B,MAAA,MAAM,OAAA,GAAU,YAAA,CAAa,GAAA,CAAI,WAAW,CAAA;AAE5C,MAAA,IAAI,CAAC,OAAA,EAAS;AACb,QAAA,MAAM,gBAAA,CAAiB;AAAA,UACtB,WAAA;AAAA,UACA,YAAA,EAAc,EAAE,OAAA,EAAS,4DAAA,EAA6D;AAAA,UACtF,KAAA,EAAO,CAAC,gBAAgB;AAAA,SACxB,CAAA;AACD,QAAA;AAAA,MACD;AAEA,MAAA,IACC,QAAQ,WAAA,KAAgB,sBAAA,CAAuB,SAAA,IAC/C,WAAA,CAAY,oBAAmB,EAC9B;AACD,QAAA,MAAM,kBAAA,CAAmB,MAAA,EAAQ,OAAA,EAAS,WAAW,CAAA;AAAA,MACtD,CAAA,MAAO;AACN,QAAA,MAAO,OAAA,CAA+B,OAAA,CAAQ,MAAA,EAAQ,WAAoB,CAAA;AAAA,MAC3E;AAAA,IACD,WAAW,WAAA,CAAY,kBAAA,EAAmB,IAAK,WAAA,CAAY,eAAc,EAAG;AAC3E,MAAA,MAAM,EAAE,OAAA,EAAS,UAAA,EAAY,MAAK,GAAI,cAAA,CAAe,YAAY,QAAQ,CAAA;AAEzE,MAAA,IAAI,OAAA,KAAY,gBAAA,CAAiB,MAAA,IAAU,EAAE,WAAA,YAAuB,iBAAA,CAAA;AACnE,QAAA;AACD,MAAA,IAAI,OAAA,KAAY,gBAAA,CAAiB,KAAA,IAAS,EAAE,WAAA,YAAuB,sBAAA,CAAA;AAClE,QAAA;AACD,MAAA,IAAI,IAAA,IAAQ,IAAA,CAAK,QAAA,CAAS,SAAS,CAAA,EAAG;AAEtC,MAAA,MAAM,SAAA,GAAY,MAAA,CAAO,MAAA,CAAO,UAAA,CAAW,IAAI,UAAU,CAAA;AAEzD,MAAA,IAAI,CAAC,SAAA,EAAW;AACf,QAAA,MAAM,gBAAA,CAAiB;AAAA,UACtB,WAAA;AAAA,UACA,YAAA,EAAc,EAAE,OAAA,EAAS,4DAAA,EAA6D;AAAA,UACtF,KAAA,EAAO,CAAC,gBAAgB;AAAA,SACxB,CAAA;AACD,QAAA;AAAA,MACD;AAEA,MAAA,MAAM,SAAA,CAAU,OAAA,CAAQ,MAAA,EAAQ,WAAW,CAAA;AAAA,IAC5C;AAAA,EACD;AACD","file":"interactionCreate.js","sourcesContent":["import { ApplicationCommandType, ButtonInteraction, ModalSubmitInteraction } from \"discord.js\";\nimport { handleSlashCommand, interactionReply } from \"src/features/commands/methods.commands.js\";\nimport { decodeCustomId } from \"src/features/customId/methods.customid.js\";\nimport { ComponentContext, type ContextCommandData, type Event } from \"#typings\";\n\nexport default {\n\tname: \"interactionCreate\",\n\tasync execute(client, interaction) {\n\t\tif (interaction.isChatInputCommand() || interaction.isContextMenuCommand()) {\n\t\t\tconst { commandName } = interaction;\n\n\t\t\tconst storeToCheck = interaction.isChatInputCommand()\n\t\t\t\t? client.stores.commands.chatInput\n\t\t\t\t: client.stores.commands.context;\n\t\t\tconst command = storeToCheck.get(commandName);\n\n\t\t\tif (!command) {\n\t\t\t\tawait interactionReply({\n\t\t\t\t\tinteraction,\n\t\t\t\t\treplyPayload: { content: \"Command is outdated, inactive, or does not have a handler!\" },\n\t\t\t\t\tflags: [\"EphemeralReply\"],\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tcommand.commandType === ApplicationCommandType.ChatInput &&\n\t\t\t\tinteraction.isChatInputCommand()\n\t\t\t) {\n\t\t\t\tawait handleSlashCommand(client, command, interaction);\n\t\t\t} else {\n\t\t\t\tawait (command as ContextCommandData).execute(client, interaction as never);\n\t\t\t}\n\t\t} else if (interaction.isMessageComponent() || interaction.isModalSubmit()) {\n\t\t\tconst { context, identifier, tags } = decodeCustomId(interaction.customId);\n\n\t\t\tif (context === ComponentContext.Button && !(interaction instanceof ButtonInteraction))\n\t\t\t\treturn;\n\t\t\tif (context === ComponentContext.Modal && !(interaction instanceof ModalSubmitInteraction))\n\t\t\t\treturn;\n\t\t\tif (tags && tags.includes(\"awaited\")) return;\n\n\t\t\tconst component = client.stores.components.get(identifier);\n\n\t\t\tif (!component) {\n\t\t\t\tawait interactionReply({\n\t\t\t\t\tinteraction,\n\t\t\t\t\treplyPayload: { content: \"Command is outdated, inactive, or does not have a handler!\" },\n\t\t\t\t\tflags: [\"EphemeralReply\"],\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tawait component.execute(client, interaction);\n\t\t}\n\t},\n} satisfies Event<\"interactionCreate\">;\n"]}
1
+ {"version":3,"sources":["../../../../src/features/events/presets/interactionCreate.ts"],"names":[],"mappings":";;;;;AAKA,IAAO,yBAAA,GAAQ;AAAA,EACd,IAAA,EAAM,mBAAA;AAAA,EACN,MAAM,OAAA,CAAQ,MAAA,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,IAAA,IAAQ,IAAA,CAAK,QAAA,CAAS,SAAS,CAAA,EAAG;AAEtC,MAAA,MAAM,SAAA,GAAY,MAAA,CAAO,MAAA,CAAO,UAAA,CAAW,IAAI,UAAU,CAAA;AAEzD,MAAA,IAAI,CAAC,SAAA,EAAW;AACf,QAAA,MAAM,gBAAA,CAAiB;AAAA,UACtB,WAAA;AAAA,UACA,YAAA,EAAc,EAAE,OAAA,EAAS,4DAAA,EAA6D;AAAA,UACtF,KAAA,EAAO,CAAC,gBAAgB;AAAA,SACxB,CAAA;AACD,QAAA;AAAA,MACD;AAEA,MAAA,MAAM,SAAA,CAAU,OAAA,CAAQ,MAAA,EAAQ,WAAW,CAAA;AAAA,IAC5C;AAAA,EACD;AACD","file":"interactionCreate.js","sourcesContent":["import { ComponentContext, type ContextCommandData, type Event } from \"#typings\";\nimport { ApplicationCommandType, ButtonInteraction, ModalSubmitInteraction } from \"discord.js\";\nimport { handleSlashCommand, interactionReply } from \"src/features/commands/methods.commands.js\";\nimport customId from \"src/features/customId/methods.customid.js\";\n\nexport default {\n\tname: \"interactionCreate\",\n\tasync execute(client, interaction) {\n\t\tif (interaction.isChatInputCommand() || interaction.isContextMenuCommand()) {\n\t\t\tconst { commandName } = interaction;\n\n\t\t\tconst storeToCheck = interaction.isChatInputCommand()\n\t\t\t\t? client.stores.commands.chatInput\n\t\t\t\t: client.stores.commands.context;\n\t\t\tconst command = storeToCheck.get(commandName);\n\n\t\t\tif (!command) {\n\t\t\t\tawait interactionReply({\n\t\t\t\t\tinteraction,\n\t\t\t\t\treplyPayload: { content: \"Command is outdated, inactive, or does not have a handler!\" },\n\t\t\t\t\tflags: [\"EphemeralReply\"],\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tcommand.commandType === ApplicationCommandType.ChatInput &&\n\t\t\t\tinteraction.isChatInputCommand()\n\t\t\t) {\n\t\t\t\tawait handleSlashCommand(client, command, interaction);\n\t\t\t} else {\n\t\t\t\tawait (command as ContextCommandData).execute(client, interaction as never);\n\t\t\t}\n\t\t} else if (interaction.isMessageComponent() || interaction.isModalSubmit()) {\n\t\t\tconst { context, identifier, tags } = customId.decode(interaction.customId);\n\n\t\t\tif (context === ComponentContext.Button && !(interaction instanceof ButtonInteraction))\n\t\t\t\treturn;\n\t\t\tif (context === ComponentContext.Modal && !(interaction instanceof ModalSubmitInteraction))\n\t\t\t\treturn;\n\t\t\tif (tags && tags.includes(\"awaited\")) return;\n\n\t\t\tconst component = client.stores.components.get(identifier);\n\n\t\t\tif (!component) {\n\t\t\t\tawait interactionReply({\n\t\t\t\t\tinteraction,\n\t\t\t\t\treplyPayload: { content: \"Command is outdated, inactive, or does not have a handler!\" },\n\t\t\t\t\tflags: [\"EphemeralReply\"],\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tawait component.execute(client, interaction);\n\t\t}\n\t},\n} satisfies Event<\"interactionCreate\">;\n"]}
@@ -1,4 +1,4 @@
1
- import { T as TriviousClient } from '../../modules.types-uNvWKT4j.js';
1
+ import { T as TriviousClient } from '../../modules.types-Czzl6XR9.js';
2
2
  import 'discord.js';
3
3
  import '../client/client.types.js';
4
4
 
@@ -1,3 +1,3 @@
1
1
  import 'discord.js';
2
- export { j as Module } from '../../modules.types-uNvWKT4j.js';
2
+ export { j as Module } from '../../modules.types-Czzl6XR9.js';
3
3
  import '../client/client.types.js';
@@ -1,4 +1,4 @@
1
- import { T as TriviousClient } from '../../modules.types-uNvWKT4j.js';
1
+ import { T as TriviousClient } from '../../modules.types-Czzl6XR9.js';
2
2
  import 'discord.js';
3
3
  import '../client/client.types.js';
4
4
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  export { createActionRow, createEmbed } from './features/builders/utility.builders.js';
2
2
  export { handleSlashCommand, interactionReply } from './features/commands/methods.commands.js';
3
- export { decodeCustomId, encodeCustomId } from './features/customId/methods.customid.js';
4
3
  export { CommandHashConfiguration, FeatureBasedStructure, TriviousClientCredentials, TriviousClientOptions, TriviousStructure, TypeBasedStructure } from './features/client/client.types.js';
5
- export { B as BaseChatInputCommandData, a as BaseCommandData, b as BaseContextCommandData, C as ChatInputCommandContext, c as CommandFlags, d as CommandFunction, e as Component, f as ComponentContext, g as ComponentFlags, h as ComponentInteraction, i as ContextCommandData, E as Event, M as MessageCommandData, j as Module, S as SlashCommandData, k as SlashSubcommandData, l as SlashSubcommandGroupData, T as TriviousClient, U as UserCommandData } from './modules.types-uNvWKT4j.js';
4
+ export { B as BaseChatInputCommandData, a as BaseCommandData, b as BaseContextCommandData, C as ChatInputCommandContext, c as CommandFlags, d as CommandFunction, e as Component, f as ComponentContext, g as ComponentFlags, h as ComponentInteraction, i as ContextCommandData, E as Event, M as MessageCommandData, j as Module, S as SlashCommandData, k as SlashSubcommandData, l as SlashSubcommandGroupData, T as TriviousClient, U as UserCommandData } from './modules.types-Czzl6XR9.js';
6
5
  export { ComponentCustomId, ComponentTag } from './features/customId/customid.types.js';
7
6
  import 'discord.js';
@@ -1,4 +1,4 @@
1
- import { Client, Collection, ApplicationCommandType, Interaction, SlashCommandBuilder, SlashCommandOptionsOnlyBuilder, SlashCommandSubcommandsOnlyBuilder, SlashCommandSubcommandBuilder, ChatInputCommandInteraction, SlashCommandSubcommandGroupBuilder, ContextMenuCommandBuilder, MessageContextMenuCommandInteraction, UserContextMenuCommandInteraction, AnySelectMenuInteraction, ButtonInteraction, ModalSubmitInteraction, ClientEvents } from 'discord.js';
1
+ import { Client, Collection, ApplicationCommandType, Interaction, SharedSlashCommand, SlashCommandSubcommandBuilder, ChatInputCommandInteraction, SlashCommandSubcommandGroupBuilder, ContextMenuCommandBuilder, MessageContextMenuCommandInteraction, UserContextMenuCommandInteraction, AnySelectMenuInteraction, ButtonInteraction, ModalSubmitInteraction, ClientEvents } from 'discord.js';
2
2
  import { TriviousClientOptions } from './features/client/client.types.js';
3
3
 
4
4
  declare class TriviousClient extends Client {
@@ -68,7 +68,7 @@ interface BaseContextCommandData extends BaseCommandData {
68
68
  */
69
69
  interface SlashCommandData extends BaseChatInputCommandData {
70
70
  context: "SlashCommand";
71
- data: SlashCommandBuilder | SlashCommandOptionsOnlyBuilder | SlashCommandSubcommandsOnlyBuilder;
71
+ data: SharedSlashCommand;
72
72
  subcommands?: Collection<string, SlashSubcommandData<true, "command">>;
73
73
  subcommandGroups?: Collection<string, SlashSubcommandGroupData<true>>;
74
74
  run?: CommandFunction<ChatInputCommandInteraction>;
@@ -2,7 +2,7 @@ import registerCommands from '../features/commands/registry.commands.js';
2
2
  import registerComponents from '../features/components/registry.components.js';
3
3
  import registerEvents, { bindEvents } from '../features/events/registry.events.js';
4
4
  import registerModules, { bindModules } from '../features/modules/registry.modules.js';
5
- import '../modules.types-uNvWKT4j.js';
5
+ import '../modules.types-Czzl6XR9.js';
6
6
  import 'discord.js';
7
7
  import '../features/client/client.types.js';
8
8
 
@@ -1,4 +1,4 @@
1
1
  export { CommandHashConfiguration, FeatureBasedStructure, TriviousClientCredentials, TriviousClientOptions, TriviousStructure, TypeBasedStructure } from '../features/client/client.types.js';
2
- export { B as BaseChatInputCommandData, a as BaseCommandData, b as BaseContextCommandData, C as ChatInputCommandContext, c as CommandFlags, d as CommandFunction, e as Component, f as ComponentContext, g as ComponentFlags, h as ComponentInteraction, i as ContextCommandData, E as Event, M as MessageCommandData, j as Module, S as SlashCommandData, k as SlashSubcommandData, l as SlashSubcommandGroupData, T as TriviousClient, U as UserCommandData } from '../modules.types-uNvWKT4j.js';
2
+ export { B as BaseChatInputCommandData, a as BaseCommandData, b as BaseContextCommandData, C as ChatInputCommandContext, c as CommandFlags, d as CommandFunction, e as Component, f as ComponentContext, g as ComponentFlags, h as ComponentInteraction, i as ContextCommandData, E as Event, M as MessageCommandData, j as Module, S as SlashCommandData, k as SlashSubcommandData, l as SlashSubcommandGroupData, T as TriviousClient, U as UserCommandData } from '../modules.types-Czzl6XR9.js';
3
3
  export { ComponentCustomId, ComponentTag } from '../features/customId/customid.types.js';
4
4
  import 'discord.js';
@@ -1,4 +1,4 @@
1
- import { a as BaseCommandData, S as SlashCommandData } from '../modules.types-uNvWKT4j.js';
1
+ import { a as BaseCommandData, S as SlashCommandData } from '../modules.types-Czzl6XR9.js';
2
2
  import 'discord.js';
3
3
  import '../features/client/client.types.js';
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trivious",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
4
4
  "type": "module",
5
5
  "keywords": [
6
6
  "discord-bot",