reciple 6.0.0-dev.27 → 6.0.0-dev.29

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 (85) hide show
  1. package/dist/lib/bin.mjs +68 -67
  2. package/dist/lib/bin.mjs.map +1 -0
  3. package/dist/lib/esm.mjs +2 -1
  4. package/dist/lib/esm.mjs.map +1 -0
  5. package/dist/lib/index.js +34 -33
  6. package/dist/lib/index.js.map +1 -0
  7. package/dist/lib/reciple/classes/RecipleClient.js +308 -307
  8. package/dist/lib/reciple/classes/RecipleClient.js.map +1 -0
  9. package/dist/lib/reciple/classes/RecipleConfig.js +107 -106
  10. package/dist/lib/reciple/classes/RecipleConfig.js.map +1 -0
  11. package/dist/lib/reciple/classes/RecipleModule.js +137 -94
  12. package/dist/lib/reciple/classes/RecipleModule.js.map +1 -0
  13. package/dist/lib/reciple/classes/builders/MessageCommandBuilder.js +310 -309
  14. package/dist/lib/reciple/classes/builders/MessageCommandBuilder.js.map +1 -0
  15. package/dist/lib/reciple/classes/builders/MessageCommandOptionBuilder.js +127 -126
  16. package/dist/lib/reciple/classes/builders/MessageCommandOptionBuilder.js.map +1 -0
  17. package/dist/lib/reciple/classes/builders/SlashCommandBuilder.js +247 -246
  18. package/dist/lib/reciple/classes/builders/SlashCommandBuilder.js.map +1 -0
  19. package/dist/lib/reciple/classes/managers/ApplicationCommandManager.js +179 -178
  20. package/dist/lib/reciple/classes/managers/ApplicationCommandManager.js.map +1 -0
  21. package/dist/lib/reciple/classes/managers/CommandCooldownManager.js +100 -99
  22. package/dist/lib/reciple/classes/managers/CommandCooldownManager.js.map +1 -0
  23. package/dist/lib/reciple/classes/managers/CommandManager.js +65 -60
  24. package/dist/lib/reciple/classes/managers/CommandManager.js.map +1 -0
  25. package/dist/lib/reciple/classes/managers/MessageCommandOptionManager.js +26 -25
  26. package/dist/lib/reciple/classes/managers/MessageCommandOptionManager.js.map +1 -0
  27. package/dist/lib/reciple/classes/managers/ModuleManager.js +181 -180
  28. package/dist/lib/reciple/classes/managers/ModuleManager.js.map +1 -0
  29. package/dist/lib/reciple/flags.js +32 -31
  30. package/dist/lib/reciple/flags.js.map +1 -0
  31. package/dist/lib/reciple/permissions.js +31 -30
  32. package/dist/lib/reciple/permissions.js.map +1 -0
  33. package/dist/lib/reciple/types/builders.js +12 -11
  34. package/dist/lib/reciple/types/builders.js.map +1 -0
  35. package/dist/lib/reciple/types/commands.js +16 -15
  36. package/dist/lib/reciple/types/commands.js.map +1 -0
  37. package/dist/lib/reciple/types/paramOptions.js +3 -2
  38. package/dist/lib/reciple/types/paramOptions.js.map +1 -0
  39. package/dist/lib/reciple/util.js +72 -71
  40. package/dist/lib/reciple/util.js.map +1 -0
  41. package/dist/lib/reciple/version.js +48 -47
  42. package/dist/lib/reciple/version.js.map +1 -0
  43. package/dist/types/bin.d.mts +3 -2
  44. package/dist/types/bin.d.mts.map +1 -0
  45. package/dist/types/esm.d.mts +2 -1
  46. package/dist/types/esm.d.mts.map +1 -0
  47. package/dist/types/index.d.ts +18 -17
  48. package/dist/types/index.d.ts.map +1 -0
  49. package/dist/types/reciple/classes/RecipleClient.d.ts +115 -114
  50. package/dist/types/reciple/classes/RecipleClient.d.ts.map +1 -0
  51. package/dist/types/reciple/classes/RecipleConfig.d.ts +101 -100
  52. package/dist/types/reciple/classes/RecipleConfig.d.ts.map +1 -0
  53. package/dist/types/reciple/classes/RecipleModule.d.ts +88 -56
  54. package/dist/types/reciple/classes/RecipleModule.d.ts.map +1 -0
  55. package/dist/types/reciple/classes/builders/MessageCommandBuilder.d.ts +190 -189
  56. package/dist/types/reciple/classes/builders/MessageCommandBuilder.d.ts.map +1 -0
  57. package/dist/types/reciple/classes/builders/MessageCommandOptionBuilder.d.ts +54 -53
  58. package/dist/types/reciple/classes/builders/MessageCommandOptionBuilder.d.ts.map +1 -0
  59. package/dist/types/reciple/classes/builders/SlashCommandBuilder.d.ts +99 -98
  60. package/dist/types/reciple/classes/builders/SlashCommandBuilder.d.ts.map +1 -0
  61. package/dist/types/reciple/classes/managers/ApplicationCommandManager.d.ts +54 -53
  62. package/dist/types/reciple/classes/managers/ApplicationCommandManager.d.ts.map +1 -0
  63. package/dist/types/reciple/classes/managers/CommandCooldownManager.d.ts +71 -70
  64. package/dist/types/reciple/classes/managers/CommandCooldownManager.d.ts.map +1 -0
  65. package/dist/types/reciple/classes/managers/CommandManager.d.ts +35 -34
  66. package/dist/types/reciple/classes/managers/CommandManager.d.ts.map +1 -0
  67. package/dist/types/reciple/classes/managers/MessageCommandOptionManager.d.ts +23 -22
  68. package/dist/types/reciple/classes/managers/MessageCommandOptionManager.d.ts.map +1 -0
  69. package/dist/types/reciple/classes/managers/ModuleManager.d.ts +50 -49
  70. package/dist/types/reciple/classes/managers/ModuleManager.d.ts.map +1 -0
  71. package/dist/types/reciple/flags.d.ts +18 -17
  72. package/dist/types/reciple/flags.d.ts.map +1 -0
  73. package/dist/types/reciple/permissions.d.ts +16 -15
  74. package/dist/types/reciple/permissions.d.ts.map +1 -0
  75. package/dist/types/reciple/types/builders.d.ts +206 -205
  76. package/dist/types/reciple/types/builders.d.ts.map +1 -0
  77. package/dist/types/reciple/types/commands.d.ts +82 -81
  78. package/dist/types/reciple/types/commands.d.ts.map +1 -0
  79. package/dist/types/reciple/types/paramOptions.d.ts +102 -101
  80. package/dist/types/reciple/types/paramOptions.d.ts.map +1 -0
  81. package/dist/types/reciple/util.d.ts +27 -26
  82. package/dist/types/reciple/util.d.ts.map +1 -0
  83. package/dist/types/reciple/version.d.ts +26 -25
  84. package/dist/types/reciple/version.d.ts.map +1 -0
  85. package/package.json +8 -6
@@ -1,60 +1,65 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CommandManager = void 0;
4
- const builders_1 = require("../../types/builders");
5
- const discord_js_1 = require("discord.js");
6
- const MessageCommandBuilder_1 = require("../builders/MessageCommandBuilder");
7
- const SlashCommandBuilder_1 = require("../builders/SlashCommandBuilder");
8
- const RecipleClient_1 = require("../RecipleClient");
9
- class CommandManager {
10
- constructor(options) {
11
- this.slashCommands = new discord_js_1.Collection();
12
- this.messageCommands = new discord_js_1.Collection();
13
- this.additionalApplicationCommands = [];
14
- this.client = options.client;
15
- options.slashCommands?.forEach(e => this.slashCommands.set(e.name, SlashCommandBuilder_1.SlashCommandBuilder.resolveSlashCommand(e)));
16
- options.messageCommands?.forEach(e => this.messageCommands.set(e.name, MessageCommandBuilder_1.MessageCommandBuilder.resolveMessageCommand(e)));
17
- }
18
- /**
19
- * Add command to command manager
20
- * @param commands Any command data or builder
21
- */
22
- add(...commands) {
23
- for (const command of (0, discord_js_1.normalizeArray)(commands)) {
24
- if (command.type === builders_1.CommandType.SlashCommand) {
25
- this.slashCommands.set(command.name, SlashCommandBuilder_1.SlashCommandBuilder.resolveSlashCommand(command));
26
- }
27
- else if (command.type === builders_1.CommandType.MessageCommand) {
28
- this.messageCommands.set(command.name, MessageCommandBuilder_1.MessageCommandBuilder.resolveMessageCommand(command));
29
- }
30
- else {
31
- throw new Error(`Unknown reciple command type`);
32
- }
33
- }
34
- return this;
35
- }
36
- get(command, type) {
37
- switch (type) {
38
- case builders_1.CommandType.SlashCommand:
39
- return this.slashCommands.get(command);
40
- case builders_1.CommandType.MessageCommand:
41
- 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
- default:
43
- throw new TypeError('Unknown command type');
44
- }
45
- }
46
- /**
47
- * Register application commands
48
- * @param guilds Register application commands to guilds
49
- */
50
- async registerApplicationCommands(...guilds) {
51
- guilds = (0, discord_js_1.normalizeArray)(guilds);
52
- guilds = guilds.length ? guilds : (0, discord_js_1.normalizeArray)([this.client.config.commands.slashCommand.guilds]);
53
- if (!this.client.isClientLogsSilent)
54
- this.client.logger.log(`Regestering ${this.client.applicationCommands.size} application command(s) ${!guilds.length ? 'globaly' : 'to ' + guilds.length + ' guilds'}...`);
55
- await this.client.applicationCommands.set([...this.client.applicationCommands.commands], guilds);
56
- this.client.emit(RecipleClient_1.RecipleEvents.RegisterApplicationCommands);
57
- return this;
58
- }
59
- }
60
- exports.CommandManager = CommandManager;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CommandManager = void 0;
4
+ const builders_1 = require("../../types/builders");
5
+ const discord_js_1 = require("discord.js");
6
+ const MessageCommandBuilder_1 = require("../builders/MessageCommandBuilder");
7
+ const SlashCommandBuilder_1 = require("../builders/SlashCommandBuilder");
8
+ const RecipleClient_1 = require("../RecipleClient");
9
+ class CommandManager {
10
+ constructor(options) {
11
+ this.slashCommands = new discord_js_1.Collection();
12
+ this.messageCommands = new discord_js_1.Collection();
13
+ this.additionalApplicationCommands = [];
14
+ this.client = options.client;
15
+ options.slashCommands?.forEach(e => this.slashCommands.set(e.name, SlashCommandBuilder_1.SlashCommandBuilder.resolveSlashCommand(e)));
16
+ options.messageCommands?.forEach(e => this.messageCommands.set(e.name, MessageCommandBuilder_1.MessageCommandBuilder.resolveMessageCommand(e)));
17
+ }
18
+ /**
19
+ * Add command to command manager
20
+ * @param commands Any command data or builder
21
+ */
22
+ add(...commands) {
23
+ for (const command of (0, discord_js_1.normalizeArray)(commands)) {
24
+ if (command instanceof SlashCommandBuilder_1.SlashCommandBuilder || command.type === builders_1.CommandType.SlashCommand) {
25
+ this.slashCommands.set(command.name, SlashCommandBuilder_1.SlashCommandBuilder.resolveSlashCommand(command));
26
+ }
27
+ else if (command instanceof MessageCommandBuilder_1.MessageCommandBuilder || command.type === builders_1.CommandType.MessageCommand) {
28
+ this.messageCommands.set(command.name, MessageCommandBuilder_1.MessageCommandBuilder.resolveMessageCommand(command));
29
+ }
30
+ else {
31
+ throw new Error(`Unknown reciple command type`);
32
+ }
33
+ }
34
+ return this;
35
+ }
36
+ addAddtionalApplicationCommand(...commands) {
37
+ this.additionalApplicationCommands.push(...(0, discord_js_1.normalizeArray)(commands));
38
+ return this;
39
+ }
40
+ get(command, type) {
41
+ switch (type) {
42
+ case builders_1.CommandType.SlashCommand:
43
+ return this.slashCommands.get(command);
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));
46
+ default:
47
+ throw new TypeError('Unknown command type');
48
+ }
49
+ }
50
+ /**
51
+ * Register application commands
52
+ * @param guilds Register application commands to guilds
53
+ */
54
+ async registerApplicationCommands(...guilds) {
55
+ guilds = (0, discord_js_1.normalizeArray)(guilds);
56
+ guilds = guilds.length ? guilds : (0, discord_js_1.normalizeArray)([this.client.config.commands.slashCommand.guilds]);
57
+ if (!this.client.isClientLogsSilent)
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);
61
+ return this;
62
+ }
63
+ }
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,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AC,GAAG,IAAI,CAAC,MAAM,CAAC,mBAAmB,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"}
@@ -1,25 +1,26 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MessageCommandOptionManager = void 0;
4
- const discord_js_1 = require("discord.js");
5
- /**
6
- * Validated message options manager
7
- */
8
- class MessageCommandOptionManager extends Array {
9
- constructor(...data) {
10
- super(...(0, discord_js_1.normalizeArray)(data));
11
- }
12
- get(name, required) {
13
- const option = this.find(o => o.name == name);
14
- if (!option?.value == undefined && required)
15
- throw new TypeError(`Can't find option named ${name}`);
16
- return option ?? null;
17
- }
18
- getValue(name, requied) {
19
- const option = this.get(name, requied);
20
- if (!option?.value && requied)
21
- throw new TypeError(`Value of option named ${name} is undefined`);
22
- return option?.value ?? null;
23
- }
24
- }
25
- exports.MessageCommandOptionManager = MessageCommandOptionManager;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MessageCommandOptionManager = void 0;
4
+ const discord_js_1 = require("discord.js");
5
+ /**
6
+ * Validated message options manager
7
+ */
8
+ class MessageCommandOptionManager extends Array {
9
+ constructor(...data) {
10
+ super(...(0, discord_js_1.normalizeArray)(data));
11
+ }
12
+ get(name, required) {
13
+ const option = this.find(o => o.name == name);
14
+ if (!option?.value == undefined && required)
15
+ throw new TypeError(`Can't find option named ${name}`);
16
+ return option ?? null;
17
+ }
18
+ getValue(name, requied) {
19
+ const option = this.get(name, requied);
20
+ if (!option?.value && requied)
21
+ throw new TypeError(`Value of option named ${name} is undefined`);
22
+ return option?.value ?? null;
23
+ }
24
+ }
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,180 +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 util_1 = require("../../util");
8
- const util_2 = require("util");
9
- const micromatch_1 = require("micromatch");
10
- const version_1 = require("../../version");
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 loaded modules
57
- */
58
- async loadModules(options) {
59
- const loadedModules = [];
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
- loadedModules.push(module_);
70
- if (!this.client.isClientLogsSilent)
71
- this.client.logger.log(`Loaded module '${module_}'`);
72
- }
73
- catch (err) {
74
- if (options?.ignoreErrors === false)
75
- throw err;
76
- if (!this.client.isClientLogsSilent)
77
- this.client.logger.error(`Failed to load module '${module_}': `, err);
78
- }
79
- }
80
- return loadedModules;
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;
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 loaded modules
57
+ */
58
+ async loadModules(options) {
59
+ const loadedModules = [];
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
+ loadedModules.push(module_);
70
+ if (!this.client.isClientLogsSilent)
71
+ this.client.logger.log(`Loaded module '${module_}'`);
72
+ }
73
+ catch (err) {
74
+ if (options?.ignoreErrors === false)
75
+ throw err;
76
+ if (!this.client.isClientLogsSilent)
77
+ this.client.logger.error(`Failed to load module '${module_}': `, err);
78
+ }
79
+ }
80
+ return loadedModules;
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;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,CAAC,CAAC,CAAC;IAC5H,CAAC;IAED;;;;OAIG;IAC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AC,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,31 +1,32 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cwd = exports.token = exports.flags = exports.commander = void 0;
4
- const version_js_1 = require("./version.js");
5
- const commander_1 = require("commander");
6
- /**
7
- * Commander
8
- */
9
- exports.commander = new commander_1.Command()
10
- .name('reciple')
11
- .description('Reciple.js - Discord.js handler cli')
12
- .version(`v${version_js_1.rawVersion}`, '-v, --version')
13
- .argument('[current-working-directory]', 'Change the current working directory')
14
- .option('-t, --token <token>', 'Replace used bot token')
15
- .option('-c, --config <config>', 'Change path to config file')
16
- .option('-D, --debugmode', 'Enable debug mode')
17
- .option('-y, --yes', 'Automatically agree to Reciple confirmation prompts')
18
- .option('-v, --version', 'Display version')
19
- .parse();
20
- /**
21
- * Used commander flags
22
- */
23
- exports.flags = exports.commander.opts();
24
- /**
25
- * Token flag
26
- */
27
- exports.token = exports.flags.token;
28
- /**
29
- * Current working directory
30
- */
31
- exports.cwd = exports.commander.args[0] || process.cwd();
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cwd = exports.token = exports.flags = exports.commander = void 0;
4
+ const version_js_1 = require("./version.js");
5
+ const commander_1 = require("commander");
6
+ /**
7
+ * Commander
8
+ */
9
+ exports.commander = new commander_1.Command()
10
+ .name('reciple')
11
+ .description('Reciple.js - Discord.js handler cli')
12
+ .version(`v${version_js_1.rawVersion}`, '-v, --version')
13
+ .argument('[current-working-directory]', 'Change the current working directory')
14
+ .option('-t, --token <token>', 'Replace used bot token')
15
+ .option('-c, --config <config>', 'Change path to config file')
16
+ .option('-D, --debugmode', 'Enable debug mode')
17
+ .option('-y, --yes', 'Automatically agree to Reciple confirmation prompts')
18
+ .option('-v, --version', 'Display version')
19
+ .parse();
20
+ /**
21
+ * Used commander flags
22
+ */
23
+ exports.flags = exports.commander.opts();
24
+ /**
25
+ * Token flag
26
+ */
27
+ exports.token = exports.flags.token;
28
+ /**
29
+ * Current working directory
30
+ */
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"}