trivious 2.1.5 → 2.1.7

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.
@@ -6,7 +6,7 @@ import '../permissions/permissions.types.js';
6
6
  declare function createSlashCommand(data: Omit<SlashCommandData, "context" | "commandType" | "subcommands" | "subcommandGroups">): SlashCommandData;
7
7
  declare function createSubcommand(data: Omit<SlashSubcommandData, "context" | "commandType" | "parent">): SlashSubcommandData;
8
8
  declare function createSubcommandGroup(data: Omit<SlashSubcommandGroupData, "context" | "parent" | "subcommands">): SlashSubcommandGroupData;
9
- declare function createMessageComponentCommand(data: Omit<ContextCommandData<"Message">, "commandType">): ContextCommandData<"Message">;
10
- declare function createUserComponentCommand(data: Omit<ContextCommandData<"User">, "commandType">): ContextCommandData<"User">;
9
+ declare function createMessageContextCommand(data: Omit<ContextCommandData<"Message">, "commandType">): ContextCommandData<"Message">;
10
+ declare function createUserContextCommand(data: Omit<ContextCommandData<"User">, "commandType">): ContextCommandData<"User">;
11
11
 
12
- export { createMessageComponentCommand, createSlashCommand, createSubcommand, createSubcommandGroup, createUserComponentCommand };
12
+ export { createMessageContextCommand, createSlashCommand, createSubcommand, createSubcommandGroup, createUserContextCommand };
@@ -21,19 +21,19 @@ function createSubcommandGroup(data) {
21
21
  subcommands: new Collection()
22
22
  };
23
23
  }
24
- function createMessageComponentCommand(data) {
24
+ function createMessageContextCommand(data) {
25
25
  return {
26
26
  ...data,
27
27
  commandType: ApplicationCommandType.Message
28
28
  };
29
29
  }
30
- function createUserComponentCommand(data) {
30
+ function createUserContextCommand(data) {
31
31
  return {
32
32
  ...data,
33
33
  commandType: ApplicationCommandType.User
34
34
  };
35
35
  }
36
36
 
37
- export { createMessageComponentCommand, createSlashCommand, createSubcommand, createSubcommandGroup, createUserComponentCommand };
37
+ export { createMessageContextCommand, createSlashCommand, createSubcommand, createSubcommandGroup, createUserContextCommand };
38
38
  //# sourceMappingURL=builders.commands.js.map
39
39
  //# sourceMappingURL=builders.commands.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/features/commands/builders.commands.ts"],"names":[],"mappings":";;AAQO,SAAS,mBACf,IAAA,EACmB;AACnB,EAAA,OAAO;AAAA,IACN,GAAG,IAAA;AAAA,IACH,OAAA,EAAS,cAAA;AAAA,IACT,aAAa,sBAAA,CAAuB;AAAA,GACrC;AACD;AAEO,SAAS,iBACf,IAAA,EACsB;AACtB,EAAA,OAAO;AAAA,IACN,GAAG,IAAA;AAAA,IACH,OAAA,EAAS,iBAAA;AAAA,IACT,aAAa,sBAAA,CAAuB;AAAA,GACrC;AACD;AAEO,SAAS,sBACf,IAAA,EAC2B;AAC3B,EAAA,OAAO;AAAA,IACN,GAAG,IAAA;AAAA,IACH,OAAA,EAAS,sBAAA;AAAA,IACT,WAAA,EAAa,IAAI,UAAA;AAAW,GAC7B;AACD;AAEO,SAAS,8BACf,IAAA,EACgC;AAChC,EAAA,OAAO;AAAA,IACN,GAAG,IAAA;AAAA,IACH,aAAa,sBAAA,CAAuB;AAAA,GACrC;AACD;AAEO,SAAS,2BACf,IAAA,EAC6B;AAC7B,EAAA,OAAO;AAAA,IACN,GAAG,IAAA;AAAA,IACH,aAAa,sBAAA,CAAuB;AAAA,GACrC;AACD","file":"builders.commands.js","sourcesContent":["import {\n\tContextCommandData,\n\tSlashCommandData,\n\tSlashSubcommandData,\n\tSlashSubcommandGroupData,\n} from \"#typings\";\nimport { ApplicationCommandType, Collection } from \"discord.js\";\n\nexport function createSlashCommand(\n\tdata: Omit<SlashCommandData, \"context\" | \"commandType\" | \"subcommands\" | \"subcommandGroups\">\n): SlashCommandData {\n\treturn {\n\t\t...data,\n\t\tcontext: \"SlashCommand\",\n\t\tcommandType: ApplicationCommandType.ChatInput,\n\t} satisfies SlashCommandData;\n}\n\nexport function createSubcommand(\n\tdata: Omit<SlashSubcommandData, \"context\" | \"commandType\" | \"parent\">\n): SlashSubcommandData {\n\treturn {\n\t\t...data,\n\t\tcontext: \"SlashSubcommand\",\n\t\tcommandType: ApplicationCommandType.ChatInput,\n\t} satisfies SlashSubcommandData;\n}\n\nexport function createSubcommandGroup(\n\tdata: Omit<SlashSubcommandGroupData, \"context\" | \"parent\" | \"subcommands\">\n): SlashSubcommandGroupData {\n\treturn {\n\t\t...data,\n\t\tcontext: \"SlashSubcommandGroup\",\n\t\tsubcommands: new Collection(),\n\t} satisfies SlashSubcommandGroupData;\n}\n\nexport function createMessageComponentCommand(\n\tdata: Omit<ContextCommandData<\"Message\">, \"commandType\">\n): ContextCommandData<\"Message\"> {\n\treturn {\n\t\t...data,\n\t\tcommandType: ApplicationCommandType.Message,\n\t} satisfies ContextCommandData<\"Message\">;\n}\n\nexport function createUserComponentCommand(\n\tdata: Omit<ContextCommandData<\"User\">, \"commandType\">\n): ContextCommandData<\"User\"> {\n\treturn {\n\t\t...data,\n\t\tcommandType: ApplicationCommandType.User,\n\t} satisfies ContextCommandData<\"User\">;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/features/commands/builders.commands.ts"],"names":[],"mappings":";;AAQO,SAAS,mBACf,IAAA,EACmB;AACnB,EAAA,OAAO;AAAA,IACN,GAAG,IAAA;AAAA,IACH,OAAA,EAAS,cAAA;AAAA,IACT,aAAa,sBAAA,CAAuB;AAAA,GACrC;AACD;AAEO,SAAS,iBACf,IAAA,EACsB;AACtB,EAAA,OAAO;AAAA,IACN,GAAG,IAAA;AAAA,IACH,OAAA,EAAS,iBAAA;AAAA,IACT,aAAa,sBAAA,CAAuB;AAAA,GACrC;AACD;AAEO,SAAS,sBACf,IAAA,EAC2B;AAC3B,EAAA,OAAO;AAAA,IACN,GAAG,IAAA;AAAA,IACH,OAAA,EAAS,sBAAA;AAAA,IACT,WAAA,EAAa,IAAI,UAAA;AAAW,GAC7B;AACD;AAEO,SAAS,4BACf,IAAA,EACgC;AAChC,EAAA,OAAO;AAAA,IACN,GAAG,IAAA;AAAA,IACH,aAAa,sBAAA,CAAuB;AAAA,GACrC;AACD;AAEO,SAAS,yBACf,IAAA,EAC6B;AAC7B,EAAA,OAAO;AAAA,IACN,GAAG,IAAA;AAAA,IACH,aAAa,sBAAA,CAAuB;AAAA,GACrC;AACD","file":"builders.commands.js","sourcesContent":["import {\n\tContextCommandData,\n\tSlashCommandData,\n\tSlashSubcommandData,\n\tSlashSubcommandGroupData,\n} from \"#typings\";\nimport { ApplicationCommandType, Collection } from \"discord.js\";\n\nexport function createSlashCommand(\n\tdata: Omit<SlashCommandData, \"context\" | \"commandType\" | \"subcommands\" | \"subcommandGroups\">\n): SlashCommandData {\n\treturn {\n\t\t...data,\n\t\tcontext: \"SlashCommand\",\n\t\tcommandType: ApplicationCommandType.ChatInput,\n\t} satisfies SlashCommandData;\n}\n\nexport function createSubcommand(\n\tdata: Omit<SlashSubcommandData, \"context\" | \"commandType\" | \"parent\">\n): SlashSubcommandData {\n\treturn {\n\t\t...data,\n\t\tcontext: \"SlashSubcommand\",\n\t\tcommandType: ApplicationCommandType.ChatInput,\n\t} satisfies SlashSubcommandData;\n}\n\nexport function createSubcommandGroup(\n\tdata: Omit<SlashSubcommandGroupData, \"context\" | \"parent\" | \"subcommands\">\n): SlashSubcommandGroupData {\n\treturn {\n\t\t...data,\n\t\tcontext: \"SlashSubcommandGroup\",\n\t\tsubcommands: new Collection(),\n\t} satisfies SlashSubcommandGroupData;\n}\n\nexport function createMessageContextCommand(\n\tdata: Omit<ContextCommandData<\"Message\">, \"commandType\">\n): ContextCommandData<\"Message\"> {\n\treturn {\n\t\t...data,\n\t\tcommandType: ApplicationCommandType.Message,\n\t} satisfies ContextCommandData<\"Message\">;\n}\n\nexport function createUserContextCommand(\n\tdata: Omit<ContextCommandData<\"User\">, \"commandType\">\n): ContextCommandData<\"User\"> {\n\treturn {\n\t\t...data,\n\t\tcommandType: ApplicationCommandType.User,\n\t} satisfies ContextCommandData<\"User\">;\n}\n"]}
@@ -1,14 +1,23 @@
1
- import * as discord_js from 'discord.js';
2
- import { ChatInputCommandInteraction, Interaction, CacheType, InteractionReplyOptions, InteractionEditReplyOptions, MessagePayload } from 'discord.js';
1
+ import { ChatInputCommandInteraction, Interaction, CacheType, InteractionReplyOptions, InteractionResponse, InteractionEditReplyOptions, Message, MessagePayload } from 'discord.js';
3
2
  import { T as TriviousClient, S as SlashCommandData, b as CommandFlags } from '../../modules.types-BY9Ncpz7.js';
4
3
  import '../client/client.types.js';
5
4
  import '../permissions/permissions.types.js';
6
5
 
7
6
  declare function interactionReply(options: {
8
7
  interaction: Interaction<CacheType>;
9
- replyPayload: InteractionReplyOptions | InteractionEditReplyOptions | MessagePayload;
8
+ replyPayload: InteractionReplyOptions;
10
9
  flags?: (CommandFlags | "FollowUp")[];
11
- }): Promise<discord_js.Message<boolean> | discord_js.InteractionResponse<boolean> | undefined>;
10
+ }): Promise<InteractionResponse<boolean>>;
11
+ declare function interactionReply(options: {
12
+ interaction: Interaction<CacheType>;
13
+ replyPayload: InteractionEditReplyOptions;
14
+ flags?: (CommandFlags | "FollowUp")[];
15
+ }): Promise<Message<boolean>>;
16
+ declare function interactionReply(options: {
17
+ interaction: Interaction<CacheType>;
18
+ replyPayload: MessagePayload;
19
+ flags?: (CommandFlags | "FollowUp")[];
20
+ }): Promise<InteractionResponse<boolean> | Message<boolean>>;
12
21
  declare function handleSlashCommand(client: TriviousClient, command: SlashCommandData, interaction: ChatInputCommandInteraction): Promise<void>;
13
22
 
14
23
  export { handleSlashCommand, interactionReply };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/features/commands/methods.commands.ts"],"names":[],"mappings":"AAUA,eAAsB,iBAAiB,OAAA,EAIpC;AACF,EAAA,MAAM,EAAE,WAAA,EAAa,YAAA,EAAc,KAAA,EAAM,GAAI,OAAA;AAC7C,EAAA,IAAI,EAAE,WAAW,WAAA,CAAA,EAAc;AAE/B,EAAA,MAAM,OAAA,GAAU,YAAA;AAChB,EAAA,IAAI,OAAO,QAAA,CAAS,gBAAgB,GAAG,OAAA,CAAQ,KAAA,GAAQ,CAAC,WAAW,CA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viousClient } from \"#typings\";\nimport {\n\tCacheType,\n\tChatInputCommandInteraction,\n\tInteraction,\n\tInteractionEditReplyOptions,\n\tInteractionReplyOptions,\n\tMessagePayload,\n} from \"discord.js\";\n\nexport async function interactionReply(options: {\n\tinteraction: Interaction<CacheType>;\n\treplyPayload: InteractionReplyOptions | InteractionEditReplyOptions | MessagePayload;\n\tflags?: (CommandFlags | \"FollowUp\")[];\n}) {\n\tconst { interaction, replyPayload, flags } = options;\n\tif (!(\"reply\" in interaction)) return;\n\n\tconst payload = replyPayload as InteractionReplyOptions;\n\tif (flags?.includes(\"EphemeralReply\")) payload.flags = [\"Ephemeral\"];\n\n\tif (interaction.deferred || interaction.replied) {\n\t\tif (flags?.includes(\"FollowUp\")) return await interaction.followUp(payload);\n\t\treturn await interaction.editReply(payload as InteractionEditReplyOptions);\n\t}\n\n\treturn await interaction.reply(payload);\n}\n\nexport async function handleSlashCommand(\n\tclient: TriviousClient,\n\tcommand: SlashCommandData,\n\tinteraction: ChatInputCommandInteraction\n) {\n\tconst { options } = interaction;\n\n\tif (command.flags?.includes(\"Cached\") && !interaction.inCachedGuild()) return;\n\tif (command.flags?.includes(\"ExpectModal\")) return;\n\tif (command.flags?.includes(\"DeferReply\")) {\n\t\tawait interactionReply({\n\t\t\tinteraction,\n\t\t\tflags: command.flags,\n\t\t\treplyPayload: { content: \"Processing command...\" },\n\t\t});\n\t}\n\n\tif (\"run\" in command && command.run) {\n\t\ttry {\n\t\t\tawait command.run(client, interaction);\n\t\t} catch (err: any) {\n\t\t\tconsole.error(err);\n\t\t}\n\t}\n\n\tconst subcommandGroup = options.getSubcommandGroup(false);\n\tconst subcommand = options.getSubcommand(false);\n\n\tif (subcommandGroup && command.subcommandGroups && subcommand) {\n\t\tconst foundGroup = command.subcommandGroups.get(subcommandGroup);\n\t\tif (!foundGroup) {\n\t\t\tawait interactionReply({\n\t\t\t\tinteraction,\n\t\t\t\tflags: [\"EphemeralReply\"],\n\t\t\t\treplyPayload: {\n\t\t\t\t\tcontent: \"Subcommand group is outdated, inactive, or does not have a handler!\",\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tconst foundSubcommand = foundGroup.subcommands.get(subcommand);\n\t\tif (!foundSubcommand) {\n\t\t\tawait interactionReply({\n\t\t\t\tinteraction,\n\t\t\t\tflags: [\"EphemeralReply\"],\n\t\t\t\treplyPayload: { content: \"Subcommand is outdated, inactive, or does not have a handler!\" },\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\treturn await foundSubcommand.execute(client, interaction);\n\t} else if (subcommand && command.subcommands) {\n\t\tconst foundSubcommand = command.subcommands.get(subcommand);\n\t\tif (!foundSubcommand) {\n\t\t\tawait interactionReply({\n\t\t\t\tinteraction,\n\t\t\t\tflags: [\"EphemeralReply\"],\n\t\t\t\treplyPayload: { content: \"Subcommand is outdated, inactive, or does not have a handler!\" },\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\treturn await foundSubcommand.execute(client, interaction);\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/features/commands/methods.commands.ts"],"names":[],"mappings":"AA8BA,eAAsB,iBAAiB,OAAA,EAIpC;AACF,EAAA,MAAM,EAAE,WAAA,EAAa,YAAA,EAAc,KAAA,EAAM,GAAI,OAAA;AAC7C,EAAA,IAAI,EAAE,WAAW,WAAA,CAAA,EAAc;AAE/B,EAAA,MAAM,OAAA,GAAU,YAAA;AAChB,EAAA,IAAI,OAAO,QAAA,CAAS,gBAAgB,GAAG,OAAA,CAAQ,KAAA,GAAQ,CAAC,WAAW,CAAA;AAEnE,EAAA,IAAI,WAAA,CAAY,QAAA,IAAY,WAAA,CAAY,OAAA,EAAS;AAChD,IAAA,IAAI,KAAA,EAAO,SAAS,UAAU,CAAA,SAAU,MAAM,WAAA,CAAY,SAAS,OAAO,CAAA;AAC1E,IAAA,OAAO,MAAM,WAAA,CAAY,SAAA,CAAU,OAAsC,CAAA;AAAA,EAC1E;AAEA,EAAA,OAAO,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AAA,QACxB,YAAA,EAAc;AAAA,UACb,OAAA,EAAS;AAAA;AACV,OACA,CAAA;AACD,MAAA;AAAA,IACD;AAEA,IAAA,MAAM,eAAA,GAAkB,UAAA,CAAW,WAAA,CAAY,GAAA,CAAI,UAAU,CAAA;AAC7D,IAAA,IAAI,CAAC,eAAA,EAAiB;AACrB,MAAA,MAAM,gBAAA,CAAiB;AAAA,QACtB,WAAA;AAAA,QACA,KAAA,EAAO,CAAC,gBAAgB,CAAA;AAAA,QACxB,YAAA,EAAc,EAAE,OAAA,EAAS,+DAAA;AAAgE,OACzF,CAAA;AACD,MAAA;AAAA,IACD;AAEA,IAAA,OAAO,MAAM,eAAA,CAAgB,OAAA,CAAQ,MAAA,EAAQ,WAAW,CAAA;AAAA,EACzD,CAAA,MAAA,IAAW,UAAA,IAAc,OAAA,CAAQ,WAAA,EAAa;AAC7C,IAAA,MAAM,eAAA,GAAkB,OAAA,CAAQ,WAAA,CAAY,GAAA,CAAI,UAAU,CAAA;AAC1D,IAAA,IAAI,CAAC,eAAA,EAAiB;AACrB,MAAA,MAAM,gBAAA,CAAiB;AAAA,QACtB,WAAA;AAAA,QACA,KAAA,EAAO,CAAC,gBAAgB,CAAA;AAAA,QACxB,YAAA,EAAc,EAAE,OAAA,EAAS,+DAAA;AAAgE,OACzF,CAAA;AACD,MAAA;AAAA,IACD;AAEA,IAAA,OAAO,MAAM,eAAA,CAAgB,OAAA,CAAQ,MAAA,EAAQ,WAAW,CAAA;AAAA,EACzD;AACD","file":"methods.commands.js","sourcesContent":["import { CommandFlags, SlashCommandData, TriviousClient } from \"#typings\";\nimport {\n\tCacheType,\n\tChatInputCommandInteraction,\n\tInteraction,\n\tInteractionEditReplyOptions,\n\tInteractionReplyOptions,\n\tInteractionResponse,\n\tMessage,\n\tMessagePayload,\n} from \"discord.js\";\n\nexport async function interactionReply(options: {\n\tinteraction: Interaction<CacheType>;\n\treplyPayload: InteractionReplyOptions;\n\tflags?: (CommandFlags | \"FollowUp\")[];\n}): Promise<InteractionResponse<boolean>>;\n\nexport async function interactionReply(options: {\n\tinteraction: Interaction<CacheType>;\n\treplyPayload: InteractionEditReplyOptions;\n\tflags?: (CommandFlags | \"FollowUp\")[];\n}): Promise<Message<boolean>>;\n\nexport async function interactionReply(options: {\n\tinteraction: Interaction<CacheType>;\n\treplyPayload: MessagePayload;\n\tflags?: (CommandFlags | \"FollowUp\")[];\n}): Promise<InteractionResponse<boolean> | Message<boolean>>;\n\nexport async function interactionReply(options: {\n\tinteraction: Interaction<CacheType>;\n\treplyPayload: InteractionReplyOptions | InteractionEditReplyOptions | MessagePayload;\n\tflags?: (CommandFlags | \"FollowUp\")[];\n}) {\n\tconst { interaction, replyPayload, flags } = options;\n\tif (!(\"reply\" in interaction)) return;\n\n\tconst payload = replyPayload as InteractionReplyOptions;\n\tif (flags?.includes(\"EphemeralReply\")) payload.flags = [\"Ephemeral\"];\n\n\tif (interaction.deferred || interaction.replied) {\n\t\tif (flags?.includes(\"FollowUp\")) return await interaction.followUp(payload);\n\t\treturn await interaction.editReply(payload as InteractionEditReplyOptions);\n\t}\n\n\treturn await interaction.reply(payload);\n}\n\nexport async function handleSlashCommand(\n\tclient: TriviousClient,\n\tcommand: SlashCommandData,\n\tinteraction: ChatInputCommandInteraction\n) {\n\tconst { options } = interaction;\n\n\tif (command.flags?.includes(\"Cached\") && !interaction.inCachedGuild()) return;\n\tif (command.flags?.includes(\"ExpectModal\")) return;\n\tif (command.flags?.includes(\"DeferReply\")) {\n\t\tawait interactionReply({\n\t\t\tinteraction,\n\t\t\tflags: command.flags,\n\t\t\treplyPayload: { content: \"Processing command...\" },\n\t\t});\n\t}\n\n\tif (\"run\" in command && command.run) {\n\t\ttry {\n\t\t\tawait command.run(client, interaction);\n\t\t} catch (err: any) {\n\t\t\tconsole.error(err);\n\t\t}\n\t}\n\n\tconst subcommandGroup = options.getSubcommandGroup(false);\n\tconst subcommand = options.getSubcommand(false);\n\n\tif (subcommandGroup && command.subcommandGroups && subcommand) {\n\t\tconst foundGroup = command.subcommandGroups.get(subcommandGroup);\n\t\tif (!foundGroup) {\n\t\t\tawait interactionReply({\n\t\t\t\tinteraction,\n\t\t\t\tflags: [\"EphemeralReply\"],\n\t\t\t\treplyPayload: {\n\t\t\t\t\tcontent: \"Subcommand group is outdated, inactive, or does not have a handler!\",\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tconst foundSubcommand = foundGroup.subcommands.get(subcommand);\n\t\tif (!foundSubcommand) {\n\t\t\tawait interactionReply({\n\t\t\t\tinteraction,\n\t\t\t\tflags: [\"EphemeralReply\"],\n\t\t\t\treplyPayload: { content: \"Subcommand is outdated, inactive, or does not have a handler!\" },\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\treturn await foundSubcommand.execute(client, interaction);\n\t} else if (subcommand && command.subcommands) {\n\t\tconst foundSubcommand = command.subcommands.get(subcommand);\n\t\tif (!foundSubcommand) {\n\t\t\tawait interactionReply({\n\t\t\t\tinteraction,\n\t\t\t\tflags: [\"EphemeralReply\"],\n\t\t\t\treplyPayload: { content: \"Subcommand is outdated, inactive, or does not have a handler!\" },\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\treturn await foundSubcommand.execute(client, interaction);\n\t}\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { createActionRow, createEmbed } from './features/builders/utility.builders.js';
2
- export { createMessageComponentCommand, createSlashCommand, createSubcommand, createSubcommandGroup, createUserComponentCommand } from './features/commands/builders.commands.js';
2
+ export { createMessageContextCommand, createSlashCommand, createSubcommand, createSubcommandGroup, createUserContextCommand } from './features/commands/builders.commands.js';
3
3
  export { handleSlashCommand, interactionReply } from './features/commands/methods.commands.js';
4
4
  export { default as customId } from './features/customId/methods.customid.js';
5
5
  export { CommandHashConfiguration, FeatureBasedStructure, TriviousClientCredentials, TriviousClientOptions, TriviousStructure, TypeBasedStructure } from './features/client/client.types.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trivious",
3
- "version": "2.1.5",
3
+ "version": "2.1.7",
4
4
  "type": "module",
5
5
  "keywords": [
6
6
  "discord-bot",