reciple 6.0.0-dev.9 → 6.0.2

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 (91) hide show
  1. package/LICENSE +674 -674
  2. package/README.md +182 -183
  3. package/dist/lib/bin.mjs +77 -0
  4. package/dist/lib/bin.mjs.map +1 -0
  5. package/dist/lib/esm.mjs +2 -0
  6. package/dist/lib/esm.mjs.map +1 -0
  7. package/dist/{cjs → lib}/index.js +17 -17
  8. package/dist/lib/index.js.map +1 -0
  9. package/dist/{cjs → lib}/reciple/classes/RecipleClient.js +43 -29
  10. package/dist/lib/reciple/classes/RecipleClient.js.map +1 -0
  11. package/dist/{cjs → lib}/reciple/classes/RecipleConfig.js +11 -10
  12. package/dist/lib/reciple/classes/RecipleConfig.js.map +1 -0
  13. package/dist/{cjs → lib}/reciple/classes/RecipleModule.js +58 -15
  14. package/dist/lib/reciple/classes/RecipleModule.js.map +1 -0
  15. package/dist/{cjs → lib}/reciple/classes/builders/MessageCommandBuilder.js +150 -82
  16. package/dist/lib/reciple/classes/builders/MessageCommandBuilder.js.map +1 -0
  17. package/dist/{cjs → lib}/reciple/classes/builders/MessageCommandOptionBuilder.js +55 -13
  18. package/dist/lib/reciple/classes/builders/MessageCommandOptionBuilder.js.map +1 -0
  19. package/dist/{cjs → lib}/reciple/classes/builders/SlashCommandBuilder.js +41 -10
  20. package/dist/lib/reciple/classes/builders/SlashCommandBuilder.js.map +1 -0
  21. package/dist/{cjs → lib}/reciple/classes/managers/ApplicationCommandManager.js +49 -6
  22. package/dist/lib/reciple/classes/managers/ApplicationCommandManager.js.map +1 -0
  23. package/dist/{cjs → lib}/reciple/classes/managers/CommandCooldownManager.js +1 -1
  24. package/dist/lib/reciple/classes/managers/CommandCooldownManager.js.map +1 -0
  25. package/dist/{cjs/reciple/classes/managers/ClientCommandManager.js → lib/reciple/classes/managers/CommandManager.js} +16 -13
  26. package/dist/lib/reciple/classes/managers/CommandManager.js.map +1 -0
  27. package/dist/{cjs → lib}/reciple/classes/managers/MessageCommandOptionManager.js +1 -0
  28. package/dist/lib/reciple/classes/managers/MessageCommandOptionManager.js.map +1 -0
  29. package/dist/{cjs/reciple/classes/managers/ClientModuleManager.js → lib/reciple/classes/managers/ModuleManager.js} +78 -64
  30. package/dist/lib/reciple/classes/managers/ModuleManager.js.map +1 -0
  31. package/dist/{cjs → lib}/reciple/flags.js +4 -3
  32. package/dist/lib/reciple/flags.js.map +1 -0
  33. package/dist/{cjs → lib}/reciple/permissions.js +1 -0
  34. package/dist/lib/reciple/permissions.js.map +1 -0
  35. package/dist/{cjs → lib}/reciple/types/builders.js +2 -1
  36. package/dist/lib/reciple/types/builders.js.map +1 -0
  37. package/dist/{cjs → lib}/reciple/types/commands.js +7 -6
  38. package/dist/lib/reciple/types/commands.js.map +1 -0
  39. package/dist/{cjs → lib}/reciple/types/paramOptions.js +1 -0
  40. package/dist/lib/reciple/types/paramOptions.js.map +1 -0
  41. package/dist/{cjs → lib}/reciple/util.js +13 -7
  42. package/dist/lib/reciple/util.js.map +1 -0
  43. package/dist/{cjs → lib}/reciple/version.js +1 -1
  44. package/dist/lib/reciple/version.js.map +1 -0
  45. package/dist/types/{bin.d.ts → bin.d.mts} +1 -0
  46. package/dist/types/bin.d.mts.map +1 -0
  47. package/dist/types/esm.d.mts +2 -0
  48. package/dist/types/esm.d.mts.map +1 -0
  49. package/dist/types/index.d.ts +17 -17
  50. package/dist/types/index.d.ts.map +1 -0
  51. package/dist/types/reciple/classes/RecipleClient.d.ts +23 -8
  52. package/dist/types/reciple/classes/RecipleClient.d.ts.map +1 -0
  53. package/dist/types/reciple/classes/RecipleConfig.d.ts +5 -2
  54. package/dist/types/reciple/classes/RecipleConfig.d.ts.map +1 -0
  55. package/dist/types/reciple/classes/RecipleModule.d.ts +37 -5
  56. package/dist/types/reciple/classes/RecipleModule.d.ts.map +1 -0
  57. package/dist/types/reciple/classes/builders/MessageCommandBuilder.d.ts +70 -26
  58. package/dist/types/reciple/classes/builders/MessageCommandBuilder.d.ts.map +1 -0
  59. package/dist/types/reciple/classes/builders/MessageCommandOptionBuilder.d.ts +18 -7
  60. package/dist/types/reciple/classes/builders/MessageCommandOptionBuilder.d.ts.map +1 -0
  61. package/dist/types/reciple/classes/builders/SlashCommandBuilder.d.ts +25 -10
  62. package/dist/types/reciple/classes/builders/SlashCommandBuilder.d.ts.map +1 -0
  63. package/dist/types/reciple/classes/managers/ApplicationCommandManager.d.ts +45 -6
  64. package/dist/types/reciple/classes/managers/ApplicationCommandManager.d.ts.map +1 -0
  65. package/dist/types/reciple/classes/managers/CommandCooldownManager.d.ts +1 -0
  66. package/dist/types/reciple/classes/managers/CommandCooldownManager.d.ts.map +1 -0
  67. package/dist/types/reciple/classes/managers/CommandManager.d.ts +35 -0
  68. package/dist/types/reciple/classes/managers/CommandManager.d.ts.map +1 -0
  69. package/dist/types/reciple/classes/managers/MessageCommandOptionManager.d.ts +2 -1
  70. package/dist/types/reciple/classes/managers/MessageCommandOptionManager.d.ts.map +1 -0
  71. package/dist/types/reciple/classes/managers/ModuleManager.d.ts +50 -0
  72. package/dist/types/reciple/classes/managers/ModuleManager.d.ts.map +1 -0
  73. package/dist/types/reciple/flags.d.ts +2 -1
  74. package/dist/types/reciple/flags.d.ts.map +1 -0
  75. package/dist/types/reciple/permissions.d.ts +3 -6
  76. package/dist/types/reciple/permissions.d.ts.map +1 -0
  77. package/dist/types/reciple/types/builders.d.ts +25 -16
  78. package/dist/types/reciple/types/builders.d.ts.map +1 -0
  79. package/dist/types/reciple/types/commands.d.ts +20 -15
  80. package/dist/types/reciple/types/commands.d.ts.map +1 -0
  81. package/dist/types/reciple/types/paramOptions.d.ts +80 -3
  82. package/dist/types/reciple/types/paramOptions.d.ts.map +1 -0
  83. package/dist/types/reciple/util.d.ts +9 -2
  84. package/dist/types/reciple/util.d.ts.map +1 -0
  85. package/dist/types/reciple/version.d.ts +1 -0
  86. package/dist/types/reciple/version.d.ts.map +1 -0
  87. package/package.json +44 -35
  88. package/resource/reciple.yml +27 -22
  89. package/dist/cjs/bin.js +0 -54
  90. package/dist/types/reciple/classes/managers/ClientCommandManager.d.ts +0 -37
  91. package/dist/types/reciple/classes/managers/ClientModuleManager.d.ts +0 -19
@@ -4,9 +4,20 @@ exports.ApplicationCommandManager = void 0;
4
4
  const discord_js_1 = require("discord.js");
5
5
  const SlashCommandBuilder_1 = require("../builders/SlashCommandBuilder");
6
6
  class ApplicationCommandManager {
7
+ get commands() {
8
+ return [...this.client.commands.additionalApplicationCommands, ...this.client.commands.slashCommands.toJSON()];
9
+ }
10
+ get size() {
11
+ return this.commands.length;
12
+ }
7
13
  constructor(client) {
8
14
  this.client = client;
9
15
  }
16
+ /**
17
+ * Sets application commands globally or in guilds
18
+ * @param commands Application commands
19
+ * @param guilds set only to guilds
20
+ */
10
21
  async set(commands, ...guilds) {
11
22
  guilds = (0, discord_js_1.normalizeArray)(guilds);
12
23
  if (!this.client.isReady())
@@ -22,14 +33,19 @@ class ApplicationCommandManager {
22
33
  if (!guild) {
23
34
  await this.client.application.commands.set(commands);
24
35
  if (!this.client.isClientLogsSilent)
25
- this.client.logger.log(`Registered ${this.client.commands.applicationCommandsSize} application command(s) globally...`);
36
+ this.client.logger.log(`Registered ${this.client.applicationCommands.size} application command(s) globally...`);
26
37
  }
27
38
  else {
28
39
  await this.client.application.commands.set(commands, guild);
29
40
  if (!this.client.isClientLogsSilent)
30
- this.client.logger.log(`Registered ${this.client.commands.applicationCommandsSize} application command(s) to guild ${guild}...`);
41
+ this.client.logger.log(`Registered ${this.client.applicationCommands.size} application command(s) to guild ${guild}`);
31
42
  }
32
43
  }
44
+ /**
45
+ * Add command globally or in guilds
46
+ * @param command Application command
47
+ * @param guilds add only in guilds
48
+ */
33
49
  async add(command, ...guilds) {
34
50
  guilds = (0, discord_js_1.normalizeArray)(guilds);
35
51
  if (!this.client.isReady())
@@ -45,16 +61,21 @@ class ApplicationCommandManager {
45
61
  let guild = guilds?.shift();
46
62
  guild = guild ? this.client.guilds.resolveId(guild) || undefined : undefined;
47
63
  if (!guild) {
48
- await this.client.application.commands.create(command);
64
+ const newCommand = await this.client.application.commands.create(command);
49
65
  if (!this.client.isClientLogsSilent)
50
- this.client.logger.log(`Created application command '${command.name}' globally`);
66
+ this.client.logger.log(`Created application command '${newCommand.name}' globally`);
51
67
  }
52
68
  else {
53
- await this.client.application.commands.create(command, guild);
69
+ const newCommand = await this.client.application.commands.create(command, guild);
54
70
  if (!this.client.isClientLogsSilent)
55
- this.client.logger.log(`Created application command '${command.name}' to guild ${guild}`);
71
+ this.client.logger.log(`Created application command '${newCommand.name}' to guild ${guild}`);
56
72
  }
57
73
  }
74
+ /**
75
+ * Remove application command globally or in guilds
76
+ * @param command id of application commmand or ApplicationCommand class
77
+ * @param guilds Remove from guilds
78
+ */
58
79
  async remove(command, ...guilds) {
59
80
  guilds = (0, discord_js_1.normalizeArray)(guilds);
60
81
  if (!this.client.isReady())
@@ -80,6 +101,12 @@ class ApplicationCommandManager {
80
101
  this.client.logger.log(`Removed application command '${typeof command === 'string' ? command : command.name}' from guild ${guild}`);
81
102
  }
82
103
  }
104
+ /**
105
+ * Edit application command globally or in guilds
106
+ * @param command id of application command or ApplicationCommand class
107
+ * @param newCommand new application command data
108
+ * @param guilds Edit only from guilds
109
+ */
83
110
  async edit(command, newCommand, ...guilds) {
84
111
  guilds = (0, discord_js_1.normalizeArray)(guilds);
85
112
  if (!this.client.isReady())
@@ -105,18 +132,33 @@ class ApplicationCommandManager {
105
132
  this.client.logger.log(`Removed application command '${typeof command === 'string' ? command : command.name}' from guild ${guild}`);
106
133
  }
107
134
  }
135
+ /**
136
+ * Get application command from cache by application command data, builder, id, or name globally or from guid
137
+ * @param command application command data, builder, id, or name
138
+ * @param guild get command from guild
139
+ */
108
140
  get(command, guild) {
109
141
  const commands = guild ? this.client.guilds.resolve(guild)?.commands.cache : this.client.application?.commands.cache;
110
142
  if (!commands)
111
143
  throw new Error('Guild not found in cache');
112
144
  return commands.find(cmd => (typeof command === 'string' ? cmd.id === command || cmd.name === command : cmd.name === command.name || (command instanceof discord_js_1.ApplicationCommand && cmd.id === command.id)));
113
145
  }
146
+ /**
147
+ * Fetch application command by id globally or from guild
148
+ * @param commandId command id
149
+ * @param guild fetch from guild
150
+ */
114
151
  async fetch(commandId, guild) {
115
152
  const manager = guild ? this.client.guilds.resolve(guild)?.commands : this.client.application?.commands;
116
153
  if (!manager)
117
154
  throw new Error('Guild not found in cache');
118
155
  return manager.fetch(commandId);
119
156
  }
157
+ /**
158
+ * Parse application command builders to command data
159
+ * @param commands Application command builders
160
+ * @param setPermissions set slash commands permissions
161
+ */
120
162
  parseCommands(commands, setPermissions = true) {
121
163
  return commands.map(cmd => {
122
164
  if (cmd?.toJSON === undefined)
@@ -134,3 +176,4 @@ class ApplicationCommandManager {
134
176
  }
135
177
  }
136
178
  exports.ApplicationCommandManager = ApplicationCommandManager;
179
+ //# sourceMappingURL=ApplicationCommandManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApplicationCommandManager.js","sourceRoot":"","sources":["../../../../../src/reciple/classes/managers/ApplicationCommandManager.ts"],"names":[],"mappings":";;;AAAA,2CAAgR;AAChR,yEAAsE;AAMtE,MAAa,yBAAyB;IAGlC,IAAI,QAAQ;QACR,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,6BAA6B,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC;IACnH,CAAC;IAED,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;IAChC,CAAC;IAED,YAAY,MAAqB;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,GAAG,CAAC,QAA0E,EAAE,GAAG,MAAoC;QAChI,MAAM,GAAG,IAAA,2BAAc,EAAC,MAAM,CAAC,C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CAAC;IACP,CAAC;CACJ;AApLD,8DAoLC"}
@@ -26,7 +26,6 @@ class CommandCooldownManager extends Array {
26
26
  if (!Object.keys(options).length)
27
27
  throw new TypeError('Provide atleast one option to remove cooldown data.');
28
28
  const removed = [];
29
- let i = 0;
30
29
  for (let i = 0; i < this.length; i++) {
31
30
  if (!CommandCooldownManager.checkOptions(options, this[i]))
32
31
  continue;
@@ -98,3 +97,4 @@ class CommandCooldownManager extends Array {
98
97
  }
99
98
  }
100
99
  exports.CommandCooldownManager = CommandCooldownManager;
100
+ //# sourceMappingURL=CommandCooldownManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandCooldownManager.js","sourceRoot":"","sources":["../../../../../src/reciple/classes/managers/CommandCooldownManager.ts"],"names":[],"mappings":";;;AAAA,2CAAwF;AAiCxF;;GAEG;AACH,MAAa,sBAAuB,SAAQ,KAAqB;IAC7D,YAAY,GAAG,IAAiC;QAC5C,KAAK,CAAC,GAAG,IAAA,2BAAc,EAAC,IAAI,CAAC,CAAC,CAAC;IACnC,CAAC;IAED;;;OAGG;IACI,GAAG,CAAC,GAAG,OAAyB;QACnC,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,OAAgC,EAAE,QAAgB,CAAC;QAC7D,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM;YAAE,MAAM,IAAI,SAAS,CAAC,qDAAqD,CAAC,CAAC;QAE7G,MAAM,OAAO,GAAqB,EAAE,CAAC;QAErC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAClC,IAAI,CAAC,sBAAsB,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;gBAAE,SAAS;YACrE,IAAI,OAAO,CAAC,UAAU,IAAI,IAAI,CAAC,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E,IAAI,CAAC,CAAC,CAAC;IACjF,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,YAAY,CAAC,OAAoD,EAAE,IAAoB;QACjG,IAAI,OAAO,EAAE,IAAI,KAAK,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE;YAAE,OAAO,KAAK,CAAC;QAClF,IAAI,OAAO,EAAE,KAAK,KAAK,SAAS,IAAI,OAAO,CAAC,KAAK,EAAE,EAAE,KAAK,IAAI,CAAC,KAAK,EAAE,EAAE;YAAE,OAAO,KAAK,CAAC;QACvF,IAAI,OAAO,EAAE,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,IAAI,CAAC,OAAO,EAAE,EAAE;YAAE,OAAO,KAAK,CAAC;QAC5F,IAAI,OAAO,EAAE,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,OAAO,KAAK,IAAI,CAAC,OAAO;YAAE,OAAO,KAAK,CAAC;QACrF,IAAI,OAAO,EAAE,IAAI,KAAK,SAAS,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI;YAAE,OAAO,KAAK,CAAC;QAE5E,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAzFD,wDAyFC"}
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ClientCommandManager = void 0;
4
- const discord_js_1 = require("discord.js");
3
+ exports.CommandManager = void 0;
5
4
  const builders_1 = require("../../types/builders");
5
+ const discord_js_1 = require("discord.js");
6
6
  const MessageCommandBuilder_1 = require("../builders/MessageCommandBuilder");
7
7
  const SlashCommandBuilder_1 = require("../builders/SlashCommandBuilder");
8
- class ClientCommandManager {
8
+ const RecipleClient_1 = require("../RecipleClient");
9
+ class CommandManager {
9
10
  constructor(options) {
10
11
  this.slashCommands = new discord_js_1.Collection();
11
12
  this.messageCommands = new discord_js_1.Collection();
@@ -14,19 +15,16 @@ class ClientCommandManager {
14
15
  options.slashCommands?.forEach(e => this.slashCommands.set(e.name, SlashCommandBuilder_1.SlashCommandBuilder.resolveSlashCommand(e)));
15
16
  options.messageCommands?.forEach(e => this.messageCommands.set(e.name, MessageCommandBuilder_1.MessageCommandBuilder.resolveMessageCommand(e)));
16
17
  }
17
- get applicationCommandsSize() {
18
- return this.client.commands.slashCommands.size + this.client.commands.additionalApplicationCommands.length;
19
- }
20
18
  /**
21
19
  * Add command to command manager
22
20
  * @param commands Any command data or builder
23
21
  */
24
22
  add(...commands) {
25
23
  for (const command of (0, discord_js_1.normalizeArray)(commands)) {
26
- if (command.type === builders_1.CommandType.SlashCommand) {
24
+ if (command instanceof SlashCommandBuilder_1.SlashCommandBuilder || command.type === builders_1.CommandType.SlashCommand) {
27
25
  this.slashCommands.set(command.name, SlashCommandBuilder_1.SlashCommandBuilder.resolveSlashCommand(command));
28
26
  }
29
- else if (command.type === builders_1.CommandType.MessageCommand) {
27
+ else if (command instanceof MessageCommandBuilder_1.MessageCommandBuilder || command.type === builders_1.CommandType.MessageCommand) {
30
28
  this.messageCommands.set(command.name, MessageCommandBuilder_1.MessageCommandBuilder.resolveMessageCommand(command));
31
29
  }
32
30
  else {
@@ -35,12 +33,16 @@ class ClientCommandManager {
35
33
  }
36
34
  return this;
37
35
  }
36
+ addAddtionalApplicationCommand(...commands) {
37
+ this.additionalApplicationCommands.push(...(0, discord_js_1.normalizeArray)(commands));
38
+ return this;
39
+ }
38
40
  get(command, type) {
39
41
  switch (type) {
40
42
  case builders_1.CommandType.SlashCommand:
41
43
  return this.slashCommands.get(command);
42
44
  case builders_1.CommandType.MessageCommand:
43
- return this.messageCommands.get(command.toLowerCase()) ?? (this.client.config.commands.messageCommand.allowCommandAlias ? this.messageCommands.find(c => c.aliases.some(a => a == command?.toLowerCase())) : undefined);
45
+ return (this.messageCommands.get(command.toLowerCase()) ?? (this.client.config.commands.messageCommand.allowCommandAlias ? this.messageCommands.find(c => c.aliases.some(a => a == command?.toLowerCase())) : undefined));
44
46
  default:
45
47
  throw new TypeError('Unknown command type');
46
48
  }
@@ -53,10 +55,11 @@ class ClientCommandManager {
53
55
  guilds = (0, discord_js_1.normalizeArray)(guilds);
54
56
  guilds = guilds.length ? guilds : (0, discord_js_1.normalizeArray)([this.client.config.commands.slashCommand.guilds]);
55
57
  if (!this.client.isClientLogsSilent)
56
- this.client.logger.log(`Regestering ${this.applicationCommandsSize} application command(s) ${!guilds.length ? 'globaly' : 'to ' + guilds.length + ' guilds'}...`);
57
- await this.client.applicationCommands.set([...this.slashCommands.toJSON(), ...this.additionalApplicationCommands], guilds);
58
- this.client.emit('recipleRegisterApplicationCommands');
58
+ this.client.logger.log(`Regestering ${this.client.applicationCommands.size} application command(s) ${!guilds.length ? 'globaly' : 'to ' + guilds.length + ' guilds'}...`);
59
+ await this.client.applicationCommands.set([...this.client.applicationCommands.commands], guilds);
60
+ this.client.emit(RecipleClient_1.RecipleEvents.RegisterApplicationCommands);
59
61
  return this;
60
62
  }
61
63
  }
62
- exports.ClientCommandManager = ClientCommandManager;
64
+ exports.CommandManager = CommandManager;
65
+ //# sourceMappingURL=CommandManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandManager.js","sourceRoot":"","sources":["../../../../../src/reciple/classes/managers/CommandManager.ts"],"names":[],"mappings":";;;AAAA,mDAAgK;AAChK,2CAAwH;AACxH,6EAA0E;AAC1E,yEAAsE;AACtE,oDAAgE;AAQhE,MAAa,cAAc;IAMvB,YAAY,OAA8B;QAJjC,kBAAa,GAA+C,IAAI,uBAAU,EAAE,CAAC;QAC7E,oBAAe,GAA8C,IAAI,uBAAU,EAAE,CAAC;QAC9E,kCAA6B,GAAuC,EAAE,CAAC;QAG5E,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAE7B,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG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BAAmB,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;QAEjG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,6BAAa,CAAC,2BAA2B,CAAC,CAAC;QAC5D,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AArED,wCAqEC"}
@@ -23,3 +23,4 @@ class MessageCommandOptionManager extends Array {
23
23
  }
24
24
  }
25
25
  exports.MessageCommandOptionManager = MessageCommandOptionManager;
26
+ //# sourceMappingURL=MessageCommandOptionManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageCommandOptionManager.js","sourceRoot":"","sources":["../../../../../src/reciple/classes/managers/MessageCommandOptionManager.ts"],"names":[],"mappings":";;;AACA,2CAAyD;AAEzD;;GAEG;AACH,MAAa,2BAA4B,SAAQ,KAAoC;IACjF,YAAY,GAAG,IAAgD;QAC3D,KAAK,CAAC,GAAG,IAAA,2BAAc,EAAC,IAAI,CAAC,CAAC,CAAC;IACnC,CAAC;IASM,GAAG,CAAC,IAAY,EAAE,QAAkB;QACvC,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC;QAC9C,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,SAAS,IAAI,QAAQ;YAAE,MAAM,IAAI,SAAS,CAAC,2BAA2B,IAAI,EAAE,CAAC,CAAC;QAEpG,OAAO,MAAM,IAAI,IAAI,CAAC;IAC1B,CAAC;IASM,QAAQ,CAAC,IAAY,EAAE,OAAiB;QAC3C,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,OAAO;YAAE,MAAM,IAAI,SAAS,CAAC,yBAAyB,IAAI,eAAe,CAAC,CAAC;QAEjG,OAAO,MAAM,EAAE,KAAK,IAAI,IAAI,CAAC;IACjC,CAAC;CACJ;AAhCD,kEAgCC"}
@@ -1,47 +1,27 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
2
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.ClientModuleManager = void 0;
3
+ exports.ModuleManager = void 0;
30
4
  const discord_js_1 = require("discord.js");
31
5
  const fs_1 = require("fs");
32
- const path_1 = __importDefault(require("path"));
33
- const util_1 = require("util");
34
- const wildcard_match_1 = __importDefault(require("wildcard-match"));
35
- const flags_1 = require("../../flags");
36
6
  const RecipleModule_1 = require("../RecipleModule");
37
- class ClientModuleManager {
7
+ const version_1 = require("../../version");
8
+ const micromatch_1 = require("micromatch");
9
+ const util_1 = require("../../util");
10
+ const util_2 = require("util");
11
+ class ModuleManager {
38
12
  constructor(options) {
39
13
  this.modules = new discord_js_1.Collection();
40
14
  this.client = options.client;
41
15
  options.modules?.forEach(m => (m instanceof RecipleModule_1.RecipleModule ? m : new RecipleModule_1.RecipleModule({ client: this.client, script: m })));
42
16
  }
43
- async startModules(modules, ignoreErrors = true) {
44
- for (const module_ of modules) {
17
+ /**
18
+ * Start modules
19
+ * @param options start modules options
20
+ * @returns started modules
21
+ */
22
+ async startModules(options) {
23
+ const startedModules = [];
24
+ for (const module_ of options.modules) {
45
25
  if (!this.client.isClientLogsSilent)
46
26
  this.client.logger.log(`Starting module '${module_}'`);
47
27
  try {
@@ -51,76 +31,99 @@ class ClientModuleManager {
51
31
  return false;
52
32
  });
53
33
  if (error)
54
- throw new Error(`An error occured while loading module '${module_}': \n${(0, util_1.inspect)(error)}`);
34
+ throw new Error(`An error occured while loading module '${module_}': \n${(0, util_2.inspect)(error)}`);
55
35
  if (!start) {
56
36
  if (!this.client.isClientLogsSilent)
57
37
  this.client.logger.error(`Module '${module_}' returned false onStart`);
58
38
  continue;
59
39
  }
60
- this.modules.set(module_.id, module_);
40
+ if (options.addToModulesCollection !== false)
41
+ this.modules.set(module_.id, module_);
42
+ startedModules.push(module_);
61
43
  }
62
44
  catch (err) {
63
- if (!ignoreErrors)
45
+ if (options?.ignoreErrors === false)
64
46
  throw err;
65
47
  if (!this.client.isClientLogsSilent)
66
48
  this.client.logger.error(`Failed to start module '${module_}': `, err);
67
49
  }
68
50
  }
69
- return modules;
51
+ return startedModules;
70
52
  }
71
- async loadModules(modules, addModuleCommandsToClient = true, ignoreErrors = true) {
72
- for (const module_ of this.modules.toJSON()) {
53
+ /**
54
+ * Load modules
55
+ * @param options load modules options
56
+ * @returns failed load modules
57
+ */
58
+ async loadModules(options) {
59
+ const failedToLoadModules = [];
60
+ for (const module_ of options?.modules ?? this.modules.toJSON()) {
73
61
  try {
74
62
  await module_.load().catch(err => {
75
63
  throw err;
76
64
  });
65
+ if (options?.resolveCommands !== false) {
66
+ module_.resolveCommands();
67
+ this.client.commands.add(module_.commands);
68
+ }
77
69
  if (!this.client.isClientLogsSilent)
78
70
  this.client.logger.log(`Loaded module '${module_}'`);
79
- if (addModuleCommandsToClient) {
80
- this.client.commands.add(module_.commands.toJSON());
81
- }
82
71
  }
83
72
  catch (err) {
84
- if (!ignoreErrors)
73
+ if (options?.ignoreErrors === false)
85
74
  throw err;
86
75
  if (!this.client.isClientLogsSilent)
87
76
  this.client.logger.error(`Failed to load module '${module_}': `, err);
77
+ failedToLoadModules.push(module_);
88
78
  }
89
79
  }
90
- return modules;
80
+ return failedToLoadModules;
91
81
  }
92
- async unLoadModules(modules, removeUnloadedModules = true, ignoreErrors = true) {
93
- for (const module_ of this.modules.toJSON()) {
82
+ /**
83
+ * Unload modules
84
+ * @param options unload modules options
85
+ * @returns unloaded modules
86
+ */
87
+ async unloadModules(options) {
88
+ const unloadedModules = [];
89
+ for (const module_ of options?.modules ?? this.modules.toJSON()) {
94
90
  try {
95
- await module_.unLoad().catch(err => {
91
+ await module_.unload().catch(err => {
96
92
  throw err;
97
93
  });
98
- if (removeUnloadedModules)
99
- this.modules.delete(module_.id);
94
+ unloadedModules.push(module_);
100
95
  if (!this.client.isClientLogsSilent)
101
96
  this.client.logger.log(`Unloaded module '${module_}'`);
102
97
  }
103
98
  catch (err) {
104
- if (!ignoreErrors)
99
+ if (options?.ignoreErrors === false)
105
100
  throw err;
106
101
  if (!this.client.isClientLogsSilent)
107
102
  this.client.logger.error(`Failed to unLoad module '${module_}': `, err);
108
103
  }
109
104
  }
110
- return modules;
105
+ return unloadedModules;
111
106
  }
112
- async getModulesFromFiles(options) {
107
+ /**
108
+ * Resolve modules from file paths
109
+ * @param options resolve module files options
110
+ * @returns resolved modules
111
+ */
112
+ async resolveModuleFiles(options) {
113
113
  const modules = [];
114
114
  for (const file of options.files) {
115
115
  try {
116
- const resolveFile = await Promise.resolve().then(() => __importStar(require(file)));
117
- let script = resolveFile?.default ?? resolveFile;
116
+ const resolveFile = await import((util_1.path.isAbsolute(file) ? 'file://' : '') + file);
117
+ const script = resolveFile instanceof RecipleModule_1.RecipleModule || ModuleManager.validateScript(resolveFile) ? resolveFile : resolveFile?.default?.default instanceof RecipleModule_1.RecipleModule || ModuleManager.validateScript(resolveFile?.default?.default) ? resolveFile.default.default : resolveFile?.default;
118
118
  if (script instanceof RecipleModule_1.RecipleModule) {
119
119
  modules.push(script);
120
120
  continue;
121
121
  }
122
- if (!ClientModuleManager.validateScript(script))
122
+ if (!ModuleManager.validateScript(script))
123
123
  throw new Error(`Invalid module script: ${file}`);
124
+ if (!this.client.config.disableVersionCheck && !(0, discord_js_1.normalizeArray)([script.versions])?.some(v => (0, version_1.isSupportedVersion)(v, this.client.version))) {
125
+ throw new Error(`Unsupported module: ${file}`);
126
+ }
124
127
  modules.push(new RecipleModule_1.RecipleModule({
125
128
  client: this.client,
126
129
  script,
@@ -128,7 +131,7 @@ class ClientModuleManager {
128
131
  }));
129
132
  }
130
133
  catch (err) {
131
- if (options.dontSkipError)
134
+ if (options.ignoreErrors === false)
132
135
  throw err;
133
136
  if (!this.client.isClientLogsSilent)
134
137
  this.client.logger.error(`Can't resolve module from: ${file}`, err);
@@ -136,6 +139,11 @@ class ClientModuleManager {
136
139
  }
137
140
  return modules;
138
141
  }
142
+ /**
143
+ * Validate module script
144
+ * @param script module script
145
+ * @returns `true` if script is valid
146
+ */
139
147
  static validateScript(script) {
140
148
  const s = script;
141
149
  if (typeof s !== 'object')
@@ -146,22 +154,28 @@ class ClientModuleManager {
146
154
  return false;
147
155
  if (s.onLoad && typeof s.onLoad !== 'function')
148
156
  return false;
149
- if (s.onUnLoad && typeof s.onUnLoad !== 'function')
157
+ if (s.onUnload && typeof s.onUnload !== 'function')
150
158
  return false;
151
159
  return true;
152
160
  }
153
- async getModuleFiles(...folders) {
161
+ /**
162
+ * Get module file paths from folders
163
+ * @param options get module paths options
164
+ * @returns module paths
165
+ */
166
+ async getModulePaths(options) {
154
167
  const modules = [];
155
- for (const dir of (0, discord_js_1.normalizeArray)(folders).length ? (0, discord_js_1.normalizeArray)(folders) : (0, discord_js_1.normalizeArray)([this.client.config.modulesFolder])) {
168
+ for (const dir of options?.folders ?? (0, discord_js_1.normalizeArray)([this.client.config.modulesFolder])) {
156
169
  if (!(0, fs_1.existsSync)(dir))
157
170
  (0, fs_1.mkdirSync)(dir, { recursive: true });
158
171
  if (!(0, fs_1.lstatSync)(dir).isDirectory())
159
172
  continue;
160
173
  modules.push(...(0, fs_1.readdirSync)(dir)
161
- .map(file => path_1.default.join(flags_1.cwd, dir, file))
162
- .filter(file => file.endsWith('.js') || file.endsWith('.cjs')));
174
+ .map(file => util_1.path.join(!dir.startsWith('/') ? this.client.cwd : '', dir, file))
175
+ .filter(file => (options?.filter ? options.filter(file) : file.endsWith('.js'))));
163
176
  }
164
- return modules.filter(file => !this.client.config.ignoredFiles.some(ignored => (0, wildcard_match_1.default)(ignored)(path_1.default.basename(file))));
177
+ return modules.filter(file => !(0, micromatch_1.isMatch)(util_1.path.basename(file), options?.ignoredFiles ?? this.client.config.ignoredFiles));
165
178
  }
166
179
  }
167
- exports.ClientModuleManager = ClientModuleManager;
180
+ exports.ModuleManager = ModuleManager;
181
+ //# sourceMappingURL=ModuleManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModuleManager.js","sourceRoot":"","sources":["../../../../../src/reciple/classes/managers/ModuleManager.ts"],"names":[],"mappings":";;;AACA,2CAAqE;AACrE,2BAAmE;AACnE,oDAAgE;AAChE,2CAAmD;AAEnD,2CAAqC;AACrC,qCAAkC;AAClC,+BAA+B;AAO/B,MAAa,aAAa;IAItB,YAAY,OAA6B;QAFhC,YAAO,GAAsC,IAAI,uBAAU,EAAE,CAAC;QAGnE,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAE7B,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,6BAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,6BAAa,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAA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,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CACvF,CAAC;SACL;QAED,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAA,oBAAO,EAAC,WAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,YAAY,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;IAC3H,CAAC;CACJ;AAxLD,sCAwLC"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.cwd = exports.token = exports.flags = exports.commander = void 0;
4
- const version_1 = require("./version");
4
+ const version_js_1 = require("./version.js");
5
5
  const commander_1 = require("commander");
6
6
  /**
7
7
  * Commander
@@ -9,7 +9,7 @@ const commander_1 = require("commander");
9
9
  exports.commander = new commander_1.Command()
10
10
  .name('reciple')
11
11
  .description('Reciple.js - Discord.js handler cli')
12
- .version(`v${version_1.rawVersion}`, '-v, --version')
12
+ .version(`v${version_js_1.rawVersion}`, '-v, --version')
13
13
  .argument('[current-working-directory]', 'Change the current working directory')
14
14
  .option('-t, --token <token>', 'Replace used bot token')
15
15
  .option('-c, --config <config>', 'Change path to config file')
@@ -18,7 +18,7 @@ exports.commander = new commander_1.Command()
18
18
  .option('-v, --version', 'Display version')
19
19
  .parse();
20
20
  /**
21
- * Used flags
21
+ * Used commander flags
22
22
  */
23
23
  exports.flags = exports.commander.opts();
24
24
  /**
@@ -29,3 +29,4 @@ exports.token = exports.flags.token;
29
29
  * Current working directory
30
30
  */
31
31
  exports.cwd = exports.commander.args[0] || process.cwd();
32
+ //# sourceMappingURL=flags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flags.js","sourceRoot":"","sources":["../../../src/reciple/flags.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAC1C,yCAAoC;AAEpC;;GAEG;AACU,QAAA,SAAS,GAAG,IAAI,mBAAO,EAAE;KACjC,IAAI,CAAC,SAAS,CAAC;KACf,WAAW,CAAC,qCAAqC,CAAC;KAClD,OAAO,CAAC,IAAI,uBAAU,EAAE,EAAE,eAAe,CAAC;KAC1C,QAAQ,CAAC,6BAA6B,EAAE,sCAAsC,CAAC;KAC/E,MAAM,CAAC,qBAAqB,EAAE,wBAAwB,CAAC;KACvD,MAAM,CAAC,uBAAuB,EAAE,4BAA4B,CAAC;KAC7D,MAAM,CAAC,iBAAiB,EAAE,mBAAmB,CAAC;KAC9C,MAAM,CAAC,WAAW,EAAE,qDAAqD,CAAC;KAC1E,MAAM,CAAC,eAAe,EAAE,iBAAiB,CAAC;KAC1C,KAAK,EAAE,CAAC;AAEb;;GAEG;AACU,QAAA,KAAK,GAAG,iBAAS,CAAC,IAAI,EAAE,CAAC;AAEtC;;GAEG;AACU,QAAA,KAAK,GAAuB,aAAK,CAAC,KAAK,CAAC;AAErD;;GAEG;AACU,QAAA,GAAG,GAAG,iBAAS,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC"}
@@ -28,3 +28,4 @@ function botHasExecutePermissions(guildOrChannel, requiredPermissions) {
28
28
  return permissions ? permissions.has(requiredPermissions) : false;
29
29
  }
30
30
  exports.botHasExecutePermissions = botHasExecutePermissions;
31
+ //# sourceMappingURL=permissions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../../src/reciple/permissions.ts"],"names":[],"mappings":";;;AAAA,2CAAqG;AAGrG;;;GAGG;AACH,SAAgB,yBAAyB,CAAC,OAAyC;IAC/E,MAAM,OAAO,GAAG,CAAC,OAAO,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,kBAAkB,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI;QAC7K,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,yBAAyB;KACzD,CAAC;IACF,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAE7C,OAAO,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAClG,CAAC;AAPD,8DAOC;AAUD,SAAgB,wBAAwB,CAAC,cAA8C,EAAE,mBAA4C;IACjI,IAAI,CAAC,mBAAmB,EAAE,MAAM;QAAE,OAAO,IAAI,CAAC;IAE9C,IAAI,WAAW,GAA+B,IAAI,CAAC;IAEnD,IAAI,cAAc,YAAY,kBAAK,EAAE;QACjC,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,EAAE,EAAE,WAAW,IAAI,IAAI,CAAC;KAChE;SAAM;QACH,WAAW,GAAG,cAAc,EAAE,cAAc,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC;KACvF;IAED,OAAO,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACtE,CAAC;AAZD,4DAYC"}
@@ -6,6 +6,7 @@ exports.CommandType = void 0;
6
6
  */
7
7
  var CommandType;
8
8
  (function (CommandType) {
9
- CommandType[CommandType["MessageCommand"] = 0] = "MessageCommand";
10
9
  CommandType[CommandType["SlashCommand"] = 1] = "SlashCommand";
10
+ CommandType[CommandType["MessageCommand"] = 2] = "MessageCommand";
11
11
  })(CommandType = exports.CommandType || (exports.CommandType = {}));
12
+ //# sourceMappingURL=builders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builders.js","sourceRoot":"","sources":["../../../../src/reciple/types/builders.ts"],"names":[],"mappings":";;;AAoHA;;GAEG;AACH,IAAY,WAGX;AAHD,WAAY,WAAW;IACnB,6DAAgB,CAAA;IAChB,iEAAc,CAAA;AAClB,CAAC,EAHW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAGtB"}
@@ -6,10 +6,11 @@ exports.CommandHaltReason = void 0;
6
6
  */
7
7
  var CommandHaltReason;
8
8
  (function (CommandHaltReason) {
9
- CommandHaltReason[CommandHaltReason["Error"] = 0] = "Error";
10
- CommandHaltReason[CommandHaltReason["Cooldown"] = 1] = "Cooldown";
11
- CommandHaltReason[CommandHaltReason["InvalidArguments"] = 2] = "InvalidArguments";
12
- CommandHaltReason[CommandHaltReason["MissingArguments"] = 3] = "MissingArguments";
13
- CommandHaltReason[CommandHaltReason["MissingMemberPermissions"] = 4] = "MissingMemberPermissions";
14
- CommandHaltReason[CommandHaltReason["MissingBotPermissions"] = 5] = "MissingBotPermissions";
9
+ CommandHaltReason[CommandHaltReason["Error"] = 1] = "Error";
10
+ CommandHaltReason[CommandHaltReason["Cooldown"] = 2] = "Cooldown";
11
+ CommandHaltReason[CommandHaltReason["InvalidArguments"] = 3] = "InvalidArguments";
12
+ CommandHaltReason[CommandHaltReason["MissingArguments"] = 4] = "MissingArguments";
13
+ CommandHaltReason[CommandHaltReason["MissingMemberPermissions"] = 5] = "MissingMemberPermissions";
14
+ CommandHaltReason[CommandHaltReason["MissingBotPermissions"] = 6] = "MissingBotPermissions";
15
15
  })(CommandHaltReason = exports.CommandHaltReason || (exports.CommandHaltReason = {}));
16
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../../src/reciple/types/commands.ts"],"names":[],"mappings":";;;AA2FA;;GAEG;AACH,IAAY,iBAOX;AAPD,WAAY,iBAAiB;IACzB,2DAAS,CAAA;IACT,iEAAQ,CAAA;IACR,iFAAgB,CAAA;IAChB,iFAAgB,CAAA;IAChB,iGAAwB,CAAA;IACxB,2FAAqB,CAAA;AACzB,CAAC,EAPW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAO5B"}
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=paramOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paramOptions.js","sourceRoot":"","sources":["../../../../src/reciple/types/paramOptions.ts"],"names":[],"mappings":""}