reciple 6.0.0-dev.3 → 6.0.0-dev.30

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 (97) hide show
  1. package/LICENSE +674 -674
  2. package/README.md +183 -183
  3. package/dist/lib/bin.mjs +70 -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 +42 -33
  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/lib/reciple/classes/RecipleModule.js +137 -0
  14. package/dist/lib/reciple/classes/RecipleModule.js.map +1 -0
  15. package/dist/lib/reciple/classes/builders/MessageCommandBuilder.js +310 -0
  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 +43 -15
  20. package/dist/lib/reciple/classes/builders/SlashCommandBuilder.js.map +1 -0
  21. package/dist/{cjs → lib}/reciple/classes/managers/ApplicationCommandManager.js +69 -27
  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} +21 -16
  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/lib/reciple/classes/managers/ModuleManager.js +181 -0
  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/lib/reciple/types/builders.js +12 -0
  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/reciple/logger.js → lib/reciple/util.js} +40 -5
  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 +22 -8
  52. package/dist/types/reciple/classes/RecipleClient.d.ts.map +1 -0
  53. package/dist/types/reciple/classes/RecipleConfig.d.ts +4 -2
  54. package/dist/types/reciple/classes/RecipleConfig.d.ts.map +1 -0
  55. package/dist/types/reciple/classes/RecipleModule.d.ts +88 -0
  56. package/dist/types/reciple/classes/RecipleModule.d.ts.map +1 -0
  57. package/dist/types/reciple/classes/builders/MessageCommandBuilder.d.ts +67 -27
  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 +23 -12
  62. package/dist/types/reciple/classes/builders/SlashCommandBuilder.d.ts.map +1 -0
  63. package/dist/types/reciple/classes/managers/ApplicationCommandManager.d.ts +46 -12
  64. package/dist/types/reciple/classes/managers/ApplicationCommandManager.d.ts.map +1 -0
  65. package/dist/types/reciple/classes/managers/CommandCooldownManager.d.ts +3 -2
  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 +29 -20
  78. package/dist/types/reciple/types/builders.d.ts.map +1 -0
  79. package/dist/types/reciple/types/commands.d.ts +19 -18
  80. package/dist/types/reciple/types/commands.d.ts.map +1 -0
  81. package/dist/types/reciple/types/paramOptions.d.ts +80 -18
  82. package/dist/types/reciple/types/paramOptions.d.ts.map +1 -0
  83. package/dist/types/reciple/util.d.ts +17 -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 +46 -36
  88. package/resource/reciple.yml +120 -117
  89. package/dist/cjs/bin.js +0 -50
  90. package/dist/cjs/reciple/classes/builders/MessageCommandBuilder.js +0 -242
  91. package/dist/cjs/reciple/classes/managers/ClientModuleManager.js +0 -193
  92. package/dist/cjs/reciple/types/builders.js +0 -11
  93. package/dist/cjs/reciple/util.js +0 -32
  94. package/dist/types/reciple/classes/managers/ClientCommandManager.d.ts +0 -37
  95. package/dist/types/reciple/classes/managers/ClientModuleManager.d.ts +0 -79
  96. package/dist/types/reciple/logger.d.ts +0 -8
  97. package/docs/README.md +0 -1
@@ -4,126 +4,167 @@ 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
  }
10
- get commands() {
11
- return this.client.application?.commands;
12
- }
13
- async set(commands, guilds) {
16
+ /**
17
+ * Sets application commands globally or in guilds
18
+ * @param commands Application commands
19
+ * @param guilds set only to guilds
20
+ */
21
+ async set(commands, ...guilds) {
22
+ guilds = (0, discord_js_1.normalizeArray)(guilds);
14
23
  if (!this.client.isReady())
15
24
  throw new Error('Client is not ready');
16
25
  if (guilds && guilds.length > 1) {
17
26
  for (const guild of guilds) {
18
- await this.set(commands, [guild]);
27
+ await this.set(commands, guild);
19
28
  }
20
29
  return;
21
30
  }
22
31
  let guild = guilds?.shift();
23
32
  guild = guild ? this.client.guilds.resolveId(guild) || undefined : undefined;
24
33
  if (!guild) {
25
- this.client.application.commands.set(commands);
34
+ await this.client.application.commands.set(commands);
26
35
  if (!this.client.isClientLogsSilent)
27
- 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...`);
28
37
  }
29
38
  else {
30
- this.client.application.commands.set(commands, guild);
39
+ await this.client.application.commands.set(commands, guild);
31
40
  if (!this.client.isClientLogsSilent)
32
- 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}`);
33
42
  }
34
43
  }
35
- async add(command, guilds) {
44
+ /**
45
+ * Add command globally or in guilds
46
+ * @param command Application command
47
+ * @param guilds add only in guilds
48
+ */
49
+ async add(command, ...guilds) {
50
+ guilds = (0, discord_js_1.normalizeArray)(guilds);
36
51
  if (!this.client.isReady())
37
52
  throw new Error('Client is not ready');
38
53
  if (!command)
39
54
  throw new Error('Command is undefined');
40
55
  if (guilds && guilds.length > 1) {
41
56
  for (const guild of guilds) {
42
- await this.add(command, [guild]);
57
+ await this.add(command, guild);
43
58
  }
44
59
  return;
45
60
  }
46
61
  let guild = guilds?.shift();
47
62
  guild = guild ? this.client.guilds.resolveId(guild) || undefined : undefined;
48
63
  if (!guild) {
49
- this.client.application.commands.create(command);
64
+ const newCommand = await this.client.application.commands.create(command);
50
65
  if (!this.client.isClientLogsSilent)
51
- this.client.logger.log(`Created application command '${command.name}' globally`);
66
+ this.client.logger.log(`Created application command '${newCommand.name}' globally`);
52
67
  }
53
68
  else {
54
- this.client.application.commands.create(command, guild);
69
+ const newCommand = await this.client.application.commands.create(command, guild);
55
70
  if (!this.client.isClientLogsSilent)
56
- 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}`);
57
72
  }
58
73
  }
59
- async remove(command, guilds) {
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
+ */
79
+ async remove(command, ...guilds) {
80
+ guilds = (0, discord_js_1.normalizeArray)(guilds);
60
81
  if (!this.client.isReady())
61
82
  throw new Error('Client is not ready');
62
83
  if (!command)
63
84
  throw new Error('Command is undefined');
64
85
  if (guilds && guilds.length > 1) {
65
86
  for (const guild of guilds) {
66
- await this.remove(command, [guild]);
87
+ await this.remove(command, guild);
67
88
  }
68
89
  return;
69
90
  }
70
91
  let guild = guilds?.shift();
71
92
  guild = guild ? this.client.guilds.resolveId(guild) || undefined : undefined;
72
93
  if (!guild) {
73
- this.client.application.commands.delete(command);
94
+ await this.client.application.commands.delete(command);
74
95
  if (!this.client.isClientLogsSilent)
75
96
  this.client.logger.log(`Removed application command '${typeof command === 'string' ? command : command.name}' globally`);
76
97
  }
77
98
  else {
78
- this.client.application.commands.delete(command, guild);
99
+ await this.client.application.commands.delete(command, guild);
79
100
  if (!this.client.isClientLogsSilent)
80
101
  this.client.logger.log(`Removed application command '${typeof command === 'string' ? command : command.name}' from guild ${guild}`);
81
102
  }
82
103
  }
83
- async edit(command, newCommand, guilds) {
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
+ */
110
+ async edit(command, newCommand, ...guilds) {
111
+ guilds = (0, discord_js_1.normalizeArray)(guilds);
84
112
  if (!this.client.isReady())
85
113
  throw new Error('Client is not ready');
86
114
  if (!command)
87
115
  throw new Error('Command is undefined');
88
116
  if (guilds && guilds.length > 1) {
89
117
  for (const guild of guilds) {
90
- await this.edit(command, newCommand, [guild]);
118
+ await this.edit(command, newCommand, guild);
91
119
  }
92
120
  return;
93
121
  }
94
122
  let guild = guilds?.shift();
95
123
  guild = guild ? this.client.guilds.resolveId(guild) || undefined : undefined;
96
124
  if (!guild) {
97
- this.client.application.commands.edit(command, newCommand);
125
+ await this.client.application.commands.edit(command, newCommand);
98
126
  if (!this.client.isClientLogsSilent)
99
127
  this.client.logger.log(`Removed application command '${typeof command === 'string' ? command : command.name}' globally`);
100
128
  }
101
129
  else {
102
- this.client.application.commands.edit(command, newCommand, guild);
130
+ await this.client.application.commands.edit(command, newCommand, guild);
103
131
  if (!this.client.isClientLogsSilent)
104
132
  this.client.logger.log(`Removed application command '${typeof command === 'string' ? command : command.name}' from guild ${guild}`);
105
133
  }
106
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
+ */
107
140
  get(command, guild) {
108
141
  const commands = guild ? this.client.guilds.resolve(guild)?.commands.cache : this.client.application?.commands.cache;
109
142
  if (!commands)
110
143
  throw new Error('Guild not found in cache');
111
- 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));
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)));
112
145
  }
146
+ /**
147
+ * Fetch application command by id globally or from guild
148
+ * @param commandId command id
149
+ * @param guild fetch from guild
150
+ */
113
151
  async fetch(commandId, guild) {
114
152
  const manager = guild ? this.client.guilds.resolve(guild)?.commands : this.client.application?.commands;
115
153
  if (!manager)
116
154
  throw new Error('Guild not found in cache');
117
155
  return manager.fetch(commandId);
118
156
  }
157
+ /**
158
+ * Parse application command builders to command data
159
+ * @param commands Application command builders
160
+ * @param setPermissions set slash commands permissions
161
+ */
119
162
  parseCommands(commands, setPermissions = true) {
120
163
  return commands.map(cmd => {
121
164
  if (cmd?.toJSON === undefined)
122
165
  return cmd;
123
166
  if (SlashCommandBuilder_1.SlashCommandBuilder.isSlashCommandBuilder(cmd) && this.client.config.commands.slashCommand.setRequiredPermissions) {
124
- const permissions = setPermissions || this.client.config.commands.slashCommand.permissions.enabled
125
- ? this.client.config.commands.slashCommand.permissions.commands.find(cmd_ => cmd_.command.toLowerCase() === cmd.name.toLowerCase())?.permissions
126
- : undefined;
167
+ const permissions = setPermissions || this.client.config.commands.slashCommand.permissions.enabled ? this.client.config.commands.slashCommand.permissions.commands.find(cmd_ => cmd_.command.toLowerCase() === cmd.name.toLowerCase())?.permissions : undefined;
127
168
  if (permissions) {
128
169
  cmd.setRequiredMemberPermissions(...permissions);
129
170
  if (!this.client.isClientLogsSilent)
@@ -135,3 +176,4 @@ class ApplicationCommandManager {
135
176
  }
136
177
  }
137
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,CAAC;QAEhC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACnE,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YAC7B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;gBACxB,MAAM,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;aACnC;YAED,OAAO;SACV;QAED,IAAI,KAAK,GAAG,MAAM,EAAE,KAAK,EAAE,CAAC;QAC5B,KA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,SAAS;gBAAE,OAAiB,GAAwC,CAAC;YAExH,IAAI,yCAAmB,CAAC,qBAAqB,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,sBAAsB,EAAE;gBACnH,MAAM,WAAW,GAAG,cAAc,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;gBAEhQ,IAAI,WAAW,EAAE;oBACb,GAAG,CAAC,4BAA4B,CAAC,GAAG,WAAW,CAAC,CAAC;oBACjD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,kBAAkB;wBAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,gCAAgC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;iBAC7G;aACJ;YAED,OAAQ,GAAiC,CAAC,MAAM,EAAE,CAAC;QACvD,CAAC,CAAC,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,CAAC,CAAC,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE;gBAAE,SAAS;YACpE,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK;gBAAE,SAAS;YAElC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YACtB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;SAC1B;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAED;;;OAGG;IACI,YAAY,CAAC,OAAoD;QACpE,MAAM,IAAI,GAAG,IAAI,CA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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,31 +15,34 @@ 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.CommandBuilderType.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.CommandBuilderType.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
  }
30
+ else {
31
+ throw new Error(`Unknown reciple command type`);
32
+ }
32
33
  }
33
34
  return this;
34
35
  }
36
+ addAddtionalApplicationCommand(...commands) {
37
+ this.additionalApplicationCommands.push(...(0, discord_js_1.normalizeArray)(commands));
38
+ return this;
39
+ }
35
40
  get(command, type) {
36
41
  switch (type) {
37
- case builders_1.CommandBuilderType.SlashCommand:
42
+ case builders_1.CommandType.SlashCommand:
38
43
  return this.slashCommands.get(command);
39
- case builders_1.CommandBuilderType.MessageCommand:
40
- return (this.messageCommands.get(command.toLowerCase()) ??
41
- (this.client.config.commands.messageCommand.allowCommandAlias ? this.messageCommands.find(c => c.aliases.some(a => a == command?.toLowerCase())) : undefined));
44
+ case builders_1.CommandType.MessageCommand:
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));
42
46
  default:
43
47
  throw new TypeError('Unknown command type');
44
48
  }
@@ -51,10 +55,11 @@ class ClientCommandManager {
51
55
  guilds = (0, discord_js_1.normalizeArray)(guilds);
52
56
  guilds = guilds.length ? guilds : (0, discord_js_1.normalizeArray)([this.client.config.commands.slashCommand.guilds]);
53
57
  if (!this.client.isClientLogsSilent)
54
- this.client.logger.log(`Regestering ${this.applicationCommandsSize} application command(s) ${!guilds.length ? 'globaly' : 'to ' + guilds.length + ' guilds'}...`);
55
- await this.client.applicationCommands.set([...this.slashCommands.toJSON(), ...this.additionalApplicationCommands], guilds);
56
- this.client.emit('RegisterApplicationCommands');
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);
57
61
  return this;
58
62
  }
59
63
  }
60
- 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,CAAC,CAAC,CAAC,IAAI,EAAE,yCAAmB,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAChH,OAAO,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,6CAAqB,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5H,CAAC;IAED;;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MappingURL=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"}
@@ -0,0 +1,181 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ModuleManager = void 0;
4
+ const discord_js_1 = require("discord.js");
5
+ const fs_1 = require("fs");
6
+ const RecipleModule_1 = require("../RecipleModule");
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 {
12
+ constructor(options) {
13
+ this.modules = new discord_js_1.Collection();
14
+ this.client = options.client;
15
+ options.modules?.forEach(m => (m instanceof RecipleModule_1.RecipleModule ? m : new RecipleModule_1.RecipleModule({ client: this.client, script: m })));
16
+ }
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) {
25
+ if (!this.client.isClientLogsSilent)
26
+ this.client.logger.log(`Starting module '${module_}'`);
27
+ try {
28
+ let error;
29
+ const start = await module_.start().catch(err => {
30
+ error = err;
31
+ return false;
32
+ });
33
+ if (error)
34
+ throw new Error(`An error occured while loading module '${module_}': \n${(0, util_2.inspect)(error)}`);
35
+ if (!start) {
36
+ if (!this.client.isClientLogsSilent)
37
+ this.client.logger.error(`Module '${module_}' returned false onStart`);
38
+ continue;
39
+ }
40
+ if (options.addToModulesCollection !== false)
41
+ this.modules.set(module_.id, module_);
42
+ startedModules.push(module_);
43
+ }
44
+ catch (err) {
45
+ if (options?.ignoreErrors === false)
46
+ throw err;
47
+ if (!this.client.isClientLogsSilent)
48
+ this.client.logger.error(`Failed to start module '${module_}': `, err);
49
+ }
50
+ }
51
+ return startedModules;
52
+ }
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()) {
61
+ try {
62
+ await module_.load().catch(err => {
63
+ throw err;
64
+ });
65
+ if (options?.resolveCommands !== false) {
66
+ module_.resolveCommands();
67
+ this.client.commands.add(module_.commands);
68
+ }
69
+ if (!this.client.isClientLogsSilent)
70
+ this.client.logger.log(`Loaded module '${module_}'`);
71
+ }
72
+ catch (err) {
73
+ if (options?.ignoreErrors === false)
74
+ throw err;
75
+ if (!this.client.isClientLogsSilent)
76
+ this.client.logger.error(`Failed to load module '${module_}': `, err);
77
+ failedToLoadModules.push(module_);
78
+ }
79
+ }
80
+ return failedToLoadModules;
81
+ }
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()) {
90
+ try {
91
+ await module_.unload().catch(err => {
92
+ throw err;
93
+ });
94
+ unloadedModules.push(module_);
95
+ if (!this.client.isClientLogsSilent)
96
+ this.client.logger.log(`Unloaded module '${module_}'`);
97
+ }
98
+ catch (err) {
99
+ if (options?.ignoreErrors === false)
100
+ throw err;
101
+ if (!this.client.isClientLogsSilent)
102
+ this.client.logger.error(`Failed to unLoad module '${module_}': `, err);
103
+ }
104
+ }
105
+ return unloadedModules;
106
+ }
107
+ /**
108
+ * Resolve modules from file paths
109
+ * @param options resolve module files options
110
+ * @returns resolved modules
111
+ */
112
+ async resolveModuleFiles(options) {
113
+ const modules = [];
114
+ for (const file of options.files) {
115
+ try {
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
+ if (script instanceof RecipleModule_1.RecipleModule) {
119
+ modules.push(script);
120
+ continue;
121
+ }
122
+ if (!ModuleManager.validateScript(script))
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
+ }
127
+ modules.push(new RecipleModule_1.RecipleModule({
128
+ client: this.client,
129
+ script,
130
+ filePath: file,
131
+ }));
132
+ }
133
+ catch (err) {
134
+ if (options.ignoreErrors === false)
135
+ throw err;
136
+ if (!this.client.isClientLogsSilent)
137
+ this.client.logger.error(`Can't resolve module from: ${file}`, err);
138
+ }
139
+ }
140
+ return modules;
141
+ }
142
+ /**
143
+ * Validate module script
144
+ * @param script module script
145
+ * @returns `true` if script is valid
146
+ */
147
+ static validateScript(script) {
148
+ const s = script;
149
+ if (typeof s !== 'object')
150
+ return false;
151
+ if (typeof s.versions !== 'string' && !Array.isArray(s.versions))
152
+ return false;
153
+ if (typeof s.onStart !== 'function')
154
+ return false;
155
+ if (s.onLoad && typeof s.onLoad !== 'function')
156
+ return false;
157
+ if (s.onUnload && typeof s.onUnload !== 'function')
158
+ return false;
159
+ return true;
160
+ }
161
+ /**
162
+ * Get module file paths from folders
163
+ * @param options get module paths options
164
+ * @returns module paths
165
+ */
166
+ async getModulePaths(options) {
167
+ const modules = [];
168
+ for (const dir of options?.folders ?? (0, discord_js_1.normalizeArray)([this.client.config.modulesFolder])) {
169
+ if (!(0, fs_1.existsSync)(dir))
170
+ (0, fs_1.mkdirSync)(dir, { recursive: true });
171
+ if (!(0, fs_1.lstatSync)(dir).isDirectory())
172
+ continue;
173
+ modules.push(...(0, fs_1.readdirSync)(dir)
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'))));
176
+ }
177
+ return modules.filter(file => !(0, micromatch_1.isMatch)(util_1.path.basename(file), options?.ignoredFiles ?? this.client.config.ignoredFiles));
178
+ }
179
+ }
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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C;iBACd,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,WAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;iBAC9E,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,MAAM,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,"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D,4DAYC"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CommandType = void 0;
4
+ /**
5
+ * Types of command builders
6
+ */
7
+ var CommandType;
8
+ (function (CommandType) {
9
+ CommandType[CommandType["SlashCommand"] = 1] = "SlashCommand";
10
+ CommandType[CommandType["MessageCommand"] = 2] = "MessageCommand";
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":";;;AAuFA;;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":""}