reciple 6.0.0-dev.22 → 6.0.0-dev.25

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 (46) hide show
  1. package/LICENSE +674 -674
  2. package/README.md +183 -183
  3. package/dist/lib/bin.mjs +66 -65
  4. package/dist/lib/esm.mjs +1 -1
  5. package/dist/lib/index.js +33 -35
  6. package/dist/lib/reciple/classes/RecipleClient.js +296 -296
  7. package/dist/lib/reciple/classes/RecipleConfig.js +106 -106
  8. package/dist/lib/reciple/classes/RecipleModule.js +94 -94
  9. package/dist/lib/reciple/classes/builders/MessageCommandBuilder.js +309 -325
  10. package/dist/lib/reciple/classes/builders/MessageCommandOptionBuilder.js +126 -107
  11. package/dist/lib/reciple/classes/builders/SlashCommandBuilder.js +246 -246
  12. package/dist/lib/reciple/classes/managers/ApplicationCommandManager.js +178 -178
  13. package/dist/lib/reciple/classes/managers/CommandCooldownManager.js +99 -100
  14. package/dist/lib/reciple/classes/managers/CommandManager.js +59 -59
  15. package/dist/lib/reciple/classes/managers/MessageCommandOptionManager.js +25 -25
  16. package/dist/lib/reciple/classes/managers/ModuleManager.js +176 -179
  17. package/dist/lib/reciple/flags.js +31 -31
  18. package/dist/lib/reciple/permissions.js +30 -30
  19. package/dist/lib/reciple/types/builders.js +11 -11
  20. package/dist/lib/reciple/types/commands.js +15 -15
  21. package/dist/lib/reciple/types/paramOptions.js +2 -2
  22. package/dist/lib/reciple/util.js +69 -68
  23. package/dist/lib/reciple/version.js +47 -47
  24. package/dist/types/bin.d.mts +2 -2
  25. package/dist/types/esm.d.mts +1 -1
  26. package/dist/types/index.d.ts +17 -19
  27. package/dist/types/reciple/classes/RecipleClient.d.ts +104 -103
  28. package/dist/types/reciple/classes/RecipleConfig.d.ts +100 -100
  29. package/dist/types/reciple/classes/RecipleModule.d.ts +56 -56
  30. package/dist/types/reciple/classes/builders/MessageCommandBuilder.d.ts +189 -184
  31. package/dist/types/reciple/classes/builders/MessageCommandOptionBuilder.d.ts +53 -51
  32. package/dist/types/reciple/classes/builders/SlashCommandBuilder.d.ts +98 -98
  33. package/dist/types/reciple/classes/managers/ApplicationCommandManager.d.ts +53 -53
  34. package/dist/types/reciple/classes/managers/CommandCooldownManager.d.ts +70 -70
  35. package/dist/types/reciple/classes/managers/CommandManager.d.ts +34 -36
  36. package/dist/types/reciple/classes/managers/MessageCommandOptionManager.d.ts +22 -22
  37. package/dist/types/reciple/classes/managers/ModuleManager.d.ts +49 -49
  38. package/dist/types/reciple/flags.d.ts +17 -17
  39. package/dist/types/reciple/permissions.d.ts +15 -19
  40. package/dist/types/reciple/types/builders.d.ts +205 -197
  41. package/dist/types/reciple/types/commands.d.ts +81 -81
  42. package/dist/types/reciple/types/paramOptions.d.ts +101 -101
  43. package/dist/types/reciple/util.d.ts +26 -23
  44. package/dist/types/reciple/version.d.ts +25 -25
  45. package/package.json +21 -20
  46. package/resource/reciple.yml +120 -120
@@ -1,59 +1,59 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CommandManager = void 0;
4
- const discord_js_1 = require("discord.js");
5
- const builders_1 = require("../../types/builders");
6
- const MessageCommandBuilder_1 = require("../builders/MessageCommandBuilder");
7
- const SlashCommandBuilder_1 = require("../builders/SlashCommandBuilder");
8
- class CommandManager {
9
- constructor(options) {
10
- this.slashCommands = new discord_js_1.Collection();
11
- this.messageCommands = new discord_js_1.Collection();
12
- this.additionalApplicationCommands = [];
13
- this.client = options.client;
14
- options.slashCommands?.forEach(e => this.slashCommands.set(e.name, SlashCommandBuilder_1.SlashCommandBuilder.resolveSlashCommand(e)));
15
- options.messageCommands?.forEach(e => this.messageCommands.set(e.name, MessageCommandBuilder_1.MessageCommandBuilder.resolveMessageCommand(e)));
16
- }
17
- /**
18
- * Add command to command manager
19
- * @param commands Any command data or builder
20
- */
21
- add(...commands) {
22
- for (const command of (0, discord_js_1.normalizeArray)(commands)) {
23
- if (command.type === builders_1.CommandType.SlashCommand) {
24
- this.slashCommands.set(command.name, SlashCommandBuilder_1.SlashCommandBuilder.resolveSlashCommand(command));
25
- }
26
- else if (command.type === builders_1.CommandType.MessageCommand) {
27
- this.messageCommands.set(command.name, MessageCommandBuilder_1.MessageCommandBuilder.resolveMessageCommand(command));
28
- }
29
- else {
30
- throw new Error(`Unknown reciple command type`);
31
- }
32
- }
33
- return this;
34
- }
35
- get(command, type) {
36
- switch (type) {
37
- case builders_1.CommandType.SlashCommand:
38
- return this.slashCommands.get(command);
39
- case builders_1.CommandType.MessageCommand:
40
- return this.messageCommands.get(command.toLowerCase()) ?? (this.client.config.commands.messageCommand.allowCommandAlias ? this.messageCommands.find(c => c.aliases.some(a => a == command?.toLowerCase())) : undefined);
41
- default:
42
- throw new TypeError('Unknown command type');
43
- }
44
- }
45
- /**
46
- * Register application commands
47
- * @param guilds Register application commands to guilds
48
- */
49
- async registerApplicationCommands(...guilds) {
50
- guilds = (0, discord_js_1.normalizeArray)(guilds);
51
- guilds = guilds.length ? guilds : (0, discord_js_1.normalizeArray)([this.client.config.commands.slashCommand.guilds]);
52
- if (!this.client.isClientLogsSilent)
53
- this.client.logger.log(`Regestering ${this.client.applicationCommands.size} application command(s) ${!guilds.length ? 'globaly' : 'to ' + guilds.length + ' guilds'}...`);
54
- await this.client.applicationCommands.set([...this.client.applicationCommands.commands], guilds);
55
- this.client.emit('recipleRegisterApplicationCommands');
56
- return this;
57
- }
58
- }
59
- 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
+ class CommandManager {
9
+ constructor(options) {
10
+ this.slashCommands = new discord_js_1.Collection();
11
+ this.messageCommands = new discord_js_1.Collection();
12
+ this.additionalApplicationCommands = [];
13
+ this.client = options.client;
14
+ options.slashCommands?.forEach(e => this.slashCommands.set(e.name, SlashCommandBuilder_1.SlashCommandBuilder.resolveSlashCommand(e)));
15
+ options.messageCommands?.forEach(e => this.messageCommands.set(e.name, MessageCommandBuilder_1.MessageCommandBuilder.resolveMessageCommand(e)));
16
+ }
17
+ /**
18
+ * Add command to command manager
19
+ * @param commands Any command data or builder
20
+ */
21
+ add(...commands) {
22
+ for (const command of (0, discord_js_1.normalizeArray)(commands)) {
23
+ if (command.type === builders_1.CommandType.SlashCommand) {
24
+ this.slashCommands.set(command.name, SlashCommandBuilder_1.SlashCommandBuilder.resolveSlashCommand(command));
25
+ }
26
+ else if (command.type === builders_1.CommandType.MessageCommand) {
27
+ this.messageCommands.set(command.name, MessageCommandBuilder_1.MessageCommandBuilder.resolveMessageCommand(command));
28
+ }
29
+ else {
30
+ throw new Error(`Unknown reciple command type`);
31
+ }
32
+ }
33
+ return this;
34
+ }
35
+ get(command, type) {
36
+ switch (type) {
37
+ case builders_1.CommandType.SlashCommand:
38
+ return this.slashCommands.get(command);
39
+ case builders_1.CommandType.MessageCommand:
40
+ return (this.messageCommands.get(command.toLowerCase()) ?? (this.client.config.commands.messageCommand.allowCommandAlias ? this.messageCommands.find(c => c.aliases.some(a => a == command?.toLowerCase())) : undefined));
41
+ default:
42
+ throw new TypeError('Unknown command type');
43
+ }
44
+ }
45
+ /**
46
+ * Register application commands
47
+ * @param guilds Register application commands to guilds
48
+ */
49
+ async registerApplicationCommands(...guilds) {
50
+ guilds = (0, discord_js_1.normalizeArray)(guilds);
51
+ guilds = guilds.length ? guilds : (0, discord_js_1.normalizeArray)([this.client.config.commands.slashCommand.guilds]);
52
+ if (!this.client.isClientLogsSilent)
53
+ this.client.logger.log(`Regestering ${this.client.applicationCommands.size} application command(s) ${!guilds.length ? 'globaly' : 'to ' + guilds.length + ' guilds'}...`);
54
+ await this.client.applicationCommands.set([...this.client.applicationCommands.commands], guilds);
55
+ this.client.emit('recipleRegisterApplicationCommands');
56
+ return this;
57
+ }
58
+ }
59
+ exports.CommandManager = CommandManager;
@@ -1,25 +1,25 @@
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;
@@ -1,179 +1,176 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ModuleManager = void 0;
7
- const discord_js_1 = require("discord.js");
8
- const fs_1 = require("fs");
9
- const util_1 = require("util");
10
- const wildcard_match_1 = __importDefault(require("wildcard-match"));
11
- const RecipleModule_1 = require("../RecipleModule");
12
- const util_2 = require("../../util");
13
- class ModuleManager {
14
- constructor(options) {
15
- this.modules = new discord_js_1.Collection();
16
- this.client = options.client;
17
- options.modules?.forEach(m => (m instanceof RecipleModule_1.RecipleModule ? m : new RecipleModule_1.RecipleModule({ client: this.client, script: m })));
18
- }
19
- /**
20
- * Start modules
21
- * @param options start modules options
22
- * @returns started modules
23
- */
24
- async startModules(options) {
25
- const startedModules = [];
26
- for (const module_ of options.modules) {
27
- if (!this.client.isClientLogsSilent)
28
- this.client.logger.log(`Starting module '${module_}'`);
29
- try {
30
- let error;
31
- const start = await module_.start().catch(err => {
32
- error = err;
33
- return false;
34
- });
35
- if (error)
36
- throw new Error(`An error occured while loading module '${module_}': \n${(0, util_1.inspect)(error)}`);
37
- if (!start) {
38
- if (!this.client.isClientLogsSilent)
39
- this.client.logger.error(`Module '${module_}' returned false onStart`);
40
- continue;
41
- }
42
- if (options.addToModulesCollection !== false)
43
- this.modules.set(module_.id, module_);
44
- startedModules.push(module_);
45
- }
46
- catch (err) {
47
- if (options?.ignoreErrors === false)
48
- throw err;
49
- if (!this.client.isClientLogsSilent)
50
- this.client.logger.error(`Failed to start module '${module_}': `, err);
51
- }
52
- }
53
- return startedModules;
54
- }
55
- /**
56
- * Load modules
57
- * @param options load modules options
58
- * @returns loaded modules
59
- */
60
- async loadModules(options) {
61
- const loadedModules = [];
62
- for (const module_ of options?.modules ?? this.modules.toJSON()) {
63
- try {
64
- await module_.load().catch(err => {
65
- throw err;
66
- });
67
- if (options?.resolveCommands !== false) {
68
- module_.resolveCommands();
69
- this.client.commands.add(module_.commands);
70
- }
71
- loadedModules.push(module_);
72
- if (!this.client.isClientLogsSilent)
73
- this.client.logger.log(`Loaded module '${module_}'`);
74
- }
75
- catch (err) {
76
- if (options?.ignoreErrors === false)
77
- throw err;
78
- if (!this.client.isClientLogsSilent)
79
- this.client.logger.error(`Failed to load module '${module_}': `, err);
80
- }
81
- }
82
- return loadedModules;
83
- }
84
- /**
85
- * Unload modules
86
- * @param options unload modules options
87
- * @returns unloaded modules
88
- */
89
- async unloadModules(options) {
90
- const unloadedModules = [];
91
- for (const module_ of options?.modules ?? this.modules.toJSON()) {
92
- try {
93
- await module_.unload().catch(err => {
94
- throw err;
95
- });
96
- unloadedModules.push(module_);
97
- if (!this.client.isClientLogsSilent)
98
- this.client.logger.log(`Unloaded module '${module_}'`);
99
- }
100
- catch (err) {
101
- if (options?.ignoreErrors === false)
102
- throw err;
103
- if (!this.client.isClientLogsSilent)
104
- this.client.logger.error(`Failed to unLoad module '${module_}': `, err);
105
- }
106
- }
107
- return unloadedModules;
108
- }
109
- /**
110
- * Resolve modules from file paths
111
- * @param options resolve module files options
112
- * @returns resolved modules
113
- */
114
- async resolveModuleFiles(options) {
115
- const modules = [];
116
- for (const file of options.files) {
117
- try {
118
- const resolveFile = await import((util_2.path.isAbsolute(file) ? 'file://' : '') + file);
119
- let 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;
120
- if (script instanceof RecipleModule_1.RecipleModule) {
121
- modules.push(script);
122
- continue;
123
- }
124
- if (!ModuleManager.validateScript(script))
125
- throw new Error(`Invalid module script: ${file}`);
126
- modules.push(new RecipleModule_1.RecipleModule({
127
- client: this.client,
128
- script,
129
- filePath: file,
130
- }));
131
- }
132
- catch (err) {
133
- if (options.ignoreErrors === false)
134
- throw err;
135
- if (!this.client.isClientLogsSilent)
136
- this.client.logger.error(`Can't resolve module from: ${file}`, err);
137
- }
138
- }
139
- return modules;
140
- }
141
- /**
142
- * Validate module script
143
- * @param script module script
144
- * @returns `true` if script is valid
145
- */
146
- static validateScript(script) {
147
- const s = script;
148
- if (typeof s !== 'object')
149
- return false;
150
- if (typeof s.versions !== 'string' && !Array.isArray(s.versions))
151
- return false;
152
- if (typeof s.onStart !== 'function')
153
- return false;
154
- if (s.onLoad && typeof s.onLoad !== 'function')
155
- return false;
156
- if (s.onUnload && typeof s.onUnload !== 'function')
157
- return false;
158
- return true;
159
- }
160
- /**
161
- * Get module file paths from folders
162
- * @param options get module paths options
163
- * @returns module paths
164
- */
165
- async getModulePaths(options) {
166
- const modules = [];
167
- for (const dir of options?.folders ?? (0, discord_js_1.normalizeArray)([this.client.config.modulesFolder])) {
168
- if (!(0, fs_1.existsSync)(dir))
169
- (0, fs_1.mkdirSync)(dir, { recursive: true });
170
- if (!(0, fs_1.lstatSync)(dir).isDirectory())
171
- continue;
172
- modules.push(...(0, fs_1.readdirSync)(dir)
173
- .map(file => util_2.path.join(!dir.startsWith('/') ? this.client.cwd : '', dir, file))
174
- .filter(file => (options?.filter ? options.filter(file) : file.endsWith('.js'))));
175
- }
176
- return modules.filter(file => !(options?.ignoredFiles ?? this.client.config.ignoredFiles).some(ignored => (0, wildcard_match_1.default)(ignored)(util_2.path.basename(file))));
177
- }
178
- }
179
- 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 util_1 = require("../../util");
8
+ const util_2 = require("util");
9
+ const micromatch_1 = require("micromatch");
10
+ class ModuleManager {
11
+ constructor(options) {
12
+ this.modules = new discord_js_1.Collection();
13
+ this.client = options.client;
14
+ options.modules?.forEach(m => (m instanceof RecipleModule_1.RecipleModule ? m : new RecipleModule_1.RecipleModule({ client: this.client, script: m })));
15
+ }
16
+ /**
17
+ * Start modules
18
+ * @param options start modules options
19
+ * @returns started modules
20
+ */
21
+ async startModules(options) {
22
+ const startedModules = [];
23
+ for (const module_ of options.modules) {
24
+ if (!this.client.isClientLogsSilent)
25
+ this.client.logger.log(`Starting module '${module_}'`);
26
+ try {
27
+ let error;
28
+ const start = await module_.start().catch(err => {
29
+ error = err;
30
+ return false;
31
+ });
32
+ if (error)
33
+ throw new Error(`An error occured while loading module '${module_}': \n${(0, util_2.inspect)(error)}`);
34
+ if (!start) {
35
+ if (!this.client.isClientLogsSilent)
36
+ this.client.logger.error(`Module '${module_}' returned false onStart`);
37
+ continue;
38
+ }
39
+ if (options.addToModulesCollection !== false)
40
+ this.modules.set(module_.id, module_);
41
+ startedModules.push(module_);
42
+ }
43
+ catch (err) {
44
+ if (options?.ignoreErrors === false)
45
+ throw err;
46
+ if (!this.client.isClientLogsSilent)
47
+ this.client.logger.error(`Failed to start module '${module_}': `, err);
48
+ }
49
+ }
50
+ return startedModules;
51
+ }
52
+ /**
53
+ * Load modules
54
+ * @param options load modules options
55
+ * @returns loaded modules
56
+ */
57
+ async loadModules(options) {
58
+ const loadedModules = [];
59
+ for (const module_ of options?.modules ?? this.modules.toJSON()) {
60
+ try {
61
+ await module_.load().catch(err => {
62
+ throw err;
63
+ });
64
+ if (options?.resolveCommands !== false) {
65
+ module_.resolveCommands();
66
+ this.client.commands.add(module_.commands);
67
+ }
68
+ loadedModules.push(module_);
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
+ }
78
+ }
79
+ return loadedModules;
80
+ }
81
+ /**
82
+ * Unload modules
83
+ * @param options unload modules options
84
+ * @returns unloaded modules
85
+ */
86
+ async unloadModules(options) {
87
+ const unloadedModules = [];
88
+ for (const module_ of options?.modules ?? this.modules.toJSON()) {
89
+ try {
90
+ await module_.unload().catch(err => {
91
+ throw err;
92
+ });
93
+ unloadedModules.push(module_);
94
+ if (!this.client.isClientLogsSilent)
95
+ this.client.logger.log(`Unloaded module '${module_}'`);
96
+ }
97
+ catch (err) {
98
+ if (options?.ignoreErrors === false)
99
+ throw err;
100
+ if (!this.client.isClientLogsSilent)
101
+ this.client.logger.error(`Failed to unLoad module '${module_}': `, err);
102
+ }
103
+ }
104
+ return unloadedModules;
105
+ }
106
+ /**
107
+ * Resolve modules from file paths
108
+ * @param options resolve module files options
109
+ * @returns resolved modules
110
+ */
111
+ async resolveModuleFiles(options) {
112
+ const modules = [];
113
+ for (const file of options.files) {
114
+ try {
115
+ const resolveFile = await import((util_1.path.isAbsolute(file) ? 'file://' : '') + file);
116
+ 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;
117
+ if (script instanceof RecipleModule_1.RecipleModule) {
118
+ modules.push(script);
119
+ continue;
120
+ }
121
+ if (!ModuleManager.validateScript(script))
122
+ throw new Error(`Invalid module script: ${file}`);
123
+ modules.push(new RecipleModule_1.RecipleModule({
124
+ client: this.client,
125
+ script,
126
+ filePath: file,
127
+ }));
128
+ }
129
+ catch (err) {
130
+ if (options.ignoreErrors === false)
131
+ throw err;
132
+ if (!this.client.isClientLogsSilent)
133
+ this.client.logger.error(`Can't resolve module from: ${file}`, err);
134
+ }
135
+ }
136
+ return modules;
137
+ }
138
+ /**
139
+ * Validate module script
140
+ * @param script module script
141
+ * @returns `true` if script is valid
142
+ */
143
+ static validateScript(script) {
144
+ const s = script;
145
+ if (typeof s !== 'object')
146
+ return false;
147
+ if (typeof s.versions !== 'string' && !Array.isArray(s.versions))
148
+ return false;
149
+ if (typeof s.onStart !== 'function')
150
+ return false;
151
+ if (s.onLoad && typeof s.onLoad !== 'function')
152
+ return false;
153
+ if (s.onUnload && typeof s.onUnload !== 'function')
154
+ return false;
155
+ return true;
156
+ }
157
+ /**
158
+ * Get module file paths from folders
159
+ * @param options get module paths options
160
+ * @returns module paths
161
+ */
162
+ async getModulePaths(options) {
163
+ const modules = [];
164
+ for (const dir of options?.folders ?? (0, discord_js_1.normalizeArray)([this.client.config.modulesFolder])) {
165
+ if (!(0, fs_1.existsSync)(dir))
166
+ (0, fs_1.mkdirSync)(dir, { recursive: true });
167
+ if (!(0, fs_1.lstatSync)(dir).isDirectory())
168
+ continue;
169
+ modules.push(...(0, fs_1.readdirSync)(dir)
170
+ .map(file => util_1.path.join(!dir.startsWith('/') ? this.client.cwd : '', dir, file))
171
+ .filter(file => (options?.filter ? options.filter(file) : file.endsWith('.js'))));
172
+ }
173
+ return modules.filter(file => !(0, micromatch_1.isMatch)(util_1.path.basename(file), options?.ignoredFiles ?? this.client.config.ignoredFiles));
174
+ }
175
+ }
176
+ exports.ModuleManager = ModuleManager;
@@ -1,31 +1,31 @@
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 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();