reciple 6.0.3 → 7.0.0-dev.5

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 (109) hide show
  1. package/LICENSE +674 -674
  2. package/bin/bin.d.mts +2 -0
  3. package/bin/bin.mjs +73 -0
  4. package/bin/bin.mjs.map +1 -0
  5. package/bin/classes/Config.d.ts +32 -0
  6. package/bin/classes/Config.js +72 -0
  7. package/bin/classes/Config.js.map +1 -0
  8. package/bin/esm.d.mts +1 -0
  9. package/{dist/lib → bin}/esm.mjs +0 -0
  10. package/bin/esm.mjs.map +1 -0
  11. package/bin/index.d.ts +5 -0
  12. package/bin/index.js +22 -0
  13. package/bin/index.js.map +1 -0
  14. package/bin/utils/cli.d.ts +4 -0
  15. package/bin/utils/cli.js +20 -0
  16. package/bin/utils/cli.js.map +1 -0
  17. package/bin/utils/logger.d.ts +6 -0
  18. package/bin/utils/logger.js +61 -0
  19. package/bin/utils/logger.js.map +1 -0
  20. package/bin/utils/modules.d.ts +3 -0
  21. package/bin/utils/modules.js +35 -0
  22. package/bin/utils/modules.js.map +1 -0
  23. package/package.json +25 -67
  24. package/static/config.yml +97 -0
  25. package/README.md +0 -182
  26. package/dist/lib/bin.mjs +0 -77
  27. package/dist/lib/bin.mjs.map +0 -1
  28. package/dist/lib/esm.mjs.map +0 -1
  29. package/dist/lib/index.js +0 -34
  30. package/dist/lib/index.js.map +0 -1
  31. package/dist/lib/reciple/classes/RecipleClient.js +0 -293
  32. package/dist/lib/reciple/classes/RecipleClient.js.map +0 -1
  33. package/dist/lib/reciple/classes/RecipleConfig.js +0 -107
  34. package/dist/lib/reciple/classes/RecipleConfig.js.map +0 -1
  35. package/dist/lib/reciple/classes/RecipleModule.js +0 -137
  36. package/dist/lib/reciple/classes/RecipleModule.js.map +0 -1
  37. package/dist/lib/reciple/classes/builders/MessageCommandBuilder.js +0 -316
  38. package/dist/lib/reciple/classes/builders/MessageCommandBuilder.js.map +0 -1
  39. package/dist/lib/reciple/classes/builders/MessageCommandOptionBuilder.js +0 -127
  40. package/dist/lib/reciple/classes/builders/MessageCommandOptionBuilder.js.map +0 -1
  41. package/dist/lib/reciple/classes/builders/SlashCommandBuilder.js +0 -253
  42. package/dist/lib/reciple/classes/builders/SlashCommandBuilder.js.map +0 -1
  43. package/dist/lib/reciple/classes/managers/ApplicationCommandManager.js +0 -179
  44. package/dist/lib/reciple/classes/managers/ApplicationCommandManager.js.map +0 -1
  45. package/dist/lib/reciple/classes/managers/CommandCooldownManager.js +0 -100
  46. package/dist/lib/reciple/classes/managers/CommandCooldownManager.js.map +0 -1
  47. package/dist/lib/reciple/classes/managers/CommandManager.js +0 -65
  48. package/dist/lib/reciple/classes/managers/CommandManager.js.map +0 -1
  49. package/dist/lib/reciple/classes/managers/MessageCommandOptionManager.js +0 -26
  50. package/dist/lib/reciple/classes/managers/MessageCommandOptionManager.js.map +0 -1
  51. package/dist/lib/reciple/classes/managers/ModuleManager.js +0 -181
  52. package/dist/lib/reciple/classes/managers/ModuleManager.js.map +0 -1
  53. package/dist/lib/reciple/flags.js +0 -32
  54. package/dist/lib/reciple/flags.js.map +0 -1
  55. package/dist/lib/reciple/permissions.js +0 -31
  56. package/dist/lib/reciple/permissions.js.map +0 -1
  57. package/dist/lib/reciple/types/builders.js +0 -12
  58. package/dist/lib/reciple/types/builders.js.map +0 -1
  59. package/dist/lib/reciple/types/commands.js +0 -16
  60. package/dist/lib/reciple/types/commands.js.map +0 -1
  61. package/dist/lib/reciple/types/paramOptions.js +0 -3
  62. package/dist/lib/reciple/types/paramOptions.js.map +0 -1
  63. package/dist/lib/reciple/util.js +0 -72
  64. package/dist/lib/reciple/util.js.map +0 -1
  65. package/dist/lib/reciple/version.js +0 -48
  66. package/dist/lib/reciple/version.js.map +0 -1
  67. package/dist/types/bin.d.mts +0 -3
  68. package/dist/types/bin.d.mts.map +0 -1
  69. package/dist/types/esm.d.mts +0 -2
  70. package/dist/types/esm.d.mts.map +0 -1
  71. package/dist/types/index.d.ts +0 -18
  72. package/dist/types/index.d.ts.map +0 -1
  73. package/dist/types/reciple/classes/RecipleClient.d.ts +0 -116
  74. package/dist/types/reciple/classes/RecipleClient.d.ts.map +0 -1
  75. package/dist/types/reciple/classes/RecipleConfig.d.ts +0 -102
  76. package/dist/types/reciple/classes/RecipleConfig.d.ts.map +0 -1
  77. package/dist/types/reciple/classes/RecipleModule.d.ts +0 -88
  78. package/dist/types/reciple/classes/RecipleModule.d.ts.map +0 -1
  79. package/dist/types/reciple/classes/builders/MessageCommandBuilder.d.ts +0 -198
  80. package/dist/types/reciple/classes/builders/MessageCommandBuilder.d.ts.map +0 -1
  81. package/dist/types/reciple/classes/builders/MessageCommandOptionBuilder.d.ts +0 -54
  82. package/dist/types/reciple/classes/builders/MessageCommandOptionBuilder.d.ts.map +0 -1
  83. package/dist/types/reciple/classes/builders/SlashCommandBuilder.d.ts +0 -107
  84. package/dist/types/reciple/classes/builders/SlashCommandBuilder.d.ts.map +0 -1
  85. package/dist/types/reciple/classes/managers/ApplicationCommandManager.d.ts +0 -54
  86. package/dist/types/reciple/classes/managers/ApplicationCommandManager.d.ts.map +0 -1
  87. package/dist/types/reciple/classes/managers/CommandCooldownManager.d.ts +0 -71
  88. package/dist/types/reciple/classes/managers/CommandCooldownManager.d.ts.map +0 -1
  89. package/dist/types/reciple/classes/managers/CommandManager.d.ts +0 -35
  90. package/dist/types/reciple/classes/managers/CommandManager.d.ts.map +0 -1
  91. package/dist/types/reciple/classes/managers/MessageCommandOptionManager.d.ts +0 -23
  92. package/dist/types/reciple/classes/managers/MessageCommandOptionManager.d.ts.map +0 -1
  93. package/dist/types/reciple/classes/managers/ModuleManager.d.ts +0 -50
  94. package/dist/types/reciple/classes/managers/ModuleManager.d.ts.map +0 -1
  95. package/dist/types/reciple/flags.d.ts +0 -18
  96. package/dist/types/reciple/flags.d.ts.map +0 -1
  97. package/dist/types/reciple/permissions.d.ts +0 -16
  98. package/dist/types/reciple/permissions.d.ts.map +0 -1
  99. package/dist/types/reciple/types/builders.d.ts +0 -206
  100. package/dist/types/reciple/types/builders.d.ts.map +0 -1
  101. package/dist/types/reciple/types/commands.d.ts +0 -86
  102. package/dist/types/reciple/types/commands.d.ts.map +0 -1
  103. package/dist/types/reciple/types/paramOptions.d.ts +0 -102
  104. package/dist/types/reciple/types/paramOptions.d.ts.map +0 -1
  105. package/dist/types/reciple/util.d.ts +0 -27
  106. package/dist/types/reciple/util.d.ts.map +0 -1
  107. package/dist/types/reciple/version.d.ts +0 -26
  108. package/dist/types/reciple/version.d.ts.map +0 -1
  109. package/resource/reciple.yml +0 -122
@@ -1,100 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CommandCooldownManager = void 0;
4
- const discord_js_1 = require("discord.js");
5
- /**
6
- * cooled-down users manager
7
- */
8
- class CommandCooldownManager extends Array {
9
- constructor(...data) {
10
- super(...(0, discord_js_1.normalizeArray)(data));
11
- }
12
- /**
13
- * Alias for `CommandCooldownManager#push()`
14
- * @param options Cooled-down user data
15
- */
16
- add(...options) {
17
- return this.push(...options);
18
- }
19
- /**
20
- * Remove cooldown from specific user, channel or guild
21
- * @param options Remove cooldown data options
22
- * @param limit Remove cooldown data limit
23
- * @returns Returns the removed values
24
- */
25
- remove(options, limit = 0) {
26
- if (!Object.keys(options).length)
27
- throw new TypeError('Provide atleast one option to remove cooldown data.');
28
- const removed = [];
29
- for (let i = 0; i < this.length; i++) {
30
- if (!CommandCooldownManager.checkOptions(options, this[i]))
31
- continue;
32
- if (options.expireTime && this[i].expireTime > Date.now())
33
- continue;
34
- if (limit && i >= limit)
35
- continue;
36
- removed.push(this[i]);
37
- this.splice(Number(i));
38
- }
39
- return removed;
40
- }
41
- /**
42
- * Check if the given user is cooled-down
43
- * @param options Options to identify if user is on cooldown
44
- */
45
- isCooledDown(options) {
46
- const data = this.get(options);
47
- if (!data)
48
- return false;
49
- this.remove({
50
- ...data,
51
- channel: undefined,
52
- guild: undefined,
53
- type: undefined,
54
- command: undefined,
55
- });
56
- if (data.expireTime < Date.now())
57
- return false;
58
- return true;
59
- }
60
- /**
61
- * Purge non cooled-down users from this array
62
- * @param options Clean cooldown options
63
- */
64
- clean(options) {
65
- for (const index in this) {
66
- if (options && !CommandCooldownManager.checkOptions(options, this[index]))
67
- return;
68
- if (this[index].expireTime > Date.now())
69
- return;
70
- this.slice(Number(index));
71
- }
72
- }
73
- /**
74
- * Get someone's cooldown data
75
- * @param options Get cooldown data options
76
- */
77
- get(options) {
78
- return this.find(data => CommandCooldownManager.checkOptions(options, data));
79
- }
80
- /**
81
- * Check if the options are valid
82
- * @param options Options to validated
83
- * @param data Cooled-down user data
84
- */
85
- static checkOptions(options, data) {
86
- if (options?.user !== undefined && options.user.id !== data.user.id)
87
- return false;
88
- if (options?.guild !== undefined && options.guild?.id !== data.guild?.id)
89
- return false;
90
- if (options?.channel !== undefined && options.channel.id !== data.channel?.id)
91
- return false;
92
- if (options?.command !== undefined && options.command !== data.command)
93
- return false;
94
- if (options?.type !== undefined && options.type !== data.type)
95
- return false;
96
- return true;
97
- }
98
- }
99
- exports.CommandCooldownManager = CommandCooldownManager;
100
- //# sourceMappingURL=CommandCooldownManager.js.map
@@ -1 +0,0 @@
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,CAA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Property(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
@@ -1 +0,0 @@
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,EAA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";
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
@@ -1 +0,0 @@
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,181 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"ModuleManager.js","sourceRo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EAAC,GAAG,CAAC;gBAAE,IAAA,cAAS,EAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAC1D,IAAI,CAAC,IAAA,cAAS,EAAC,GAAG,CAAC,CAAC,WAAW,EAAE;gBAAE,SAAS;YAE5C,OAAO,CAAC,IAAI,CACR,GAAG,IAAA,gBAAW,EAAC,GAAG,CAAC;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,32 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.botHasExecutePermissions = exports.userHasCommandPermissions = void 0;
4
- const discord_js_1 = require("discord.js");
5
- /**
6
- * Check if the user has permissions to execute the given command name
7
- * @param options options
8
- */
9
- function userHasCommandPermissions(options) {
10
- const command = (options.commandPermissions?.enabled ? options.commandPermissions?.commands.find(c => c.command.toLowerCase() === options.builder.name.toLowerCase()) : null) ?? {
11
- permissions: options.builder.requiredMemberPermissions,
12
- };
13
- if (!command.permissions.length)
14
- return true;
15
- return options.memberPermissions ? options.memberPermissions.has(command.permissions) : false;
16
- }
17
- exports.userHasCommandPermissions = userHasCommandPermissions;
18
- function botHasExecutePermissions(guildOrChannel, requiredPermissions) {
19
- if (!requiredPermissions?.length)
20
- return true;
21
- let permissions = null;
22
- if (guildOrChannel instanceof discord_js_1.Guild) {
23
- permissions = guildOrChannel.members.me?.permissions ?? null;
24
- }
25
- else {
26
- permissions = guildOrChannel?.permissionsFor(guildOrChannel.client.user.id) ?? null;
27
- }
28
- return permissions ? permissions.has(requiredPermissions) : false;
29
- }
30
- exports.botHasExecutePermissions = botHasExecutePermissions;
31
- //# sourceMappingURL=permissions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../../src/reciple/permissions.ts"],"names":[],"mappings":";;;AAAA,2CAAqG;AAGrG;;;GAGG;AACH,SAAgB,yBAAyB,CAAC,OAAyC;IAC/E,MAAM,OAAO,GAAG,CAAC,OAAO,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,kBAAkB,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI;QAC7K,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,yBAAyB;KACzD,CAAC;IACF,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAE7C,OAAO,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAClG,CAAC;AAPD,8DAOC;AAUD,SAAgB,wBAAwB,CAAC,cAA8C,EAAE,mBAA4C;IACjI,IAAI,CAAC,mBAAmB,EAAE,MAAM;QAAE,OAAO,IAAI,CAAC;IAE9C,IAAI,WAAW,GAA+B,IAAI,CAAC;IAEnD,IAAI,cAAc,YAAY,kBAAK,EAAE;QACjC,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,EAAE,EAAE,WAAW,IAAI,IAAI,CAAC;KAChE;SAAM;QACH,WAAW,GAAG,cAAc,EAAE,cAAc,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC;KACvF;IAED,OAAO,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACtE,CAAC;AAZD,4DAYC"}
@@ -1,12 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CommandHaltReason = void 0;
4
- /**
5
- * Command halt reasons
6
- */
7
- var CommandHaltReason;
8
- (function (CommandHaltReason) {
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
- })(CommandHaltReason = exports.CommandHaltReason || (exports.CommandHaltReason = {}));
16
- //# sourceMappingURL=commands.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../../src/reciple/types/commands.ts"],"names":[],"mappings":";;;AA2FA;;GAEG;AACH,IAAY,iBAOX;AAPD,WAAY,iBAAiB;IACzB,2DAAS,CAAA;IACT,iEAAQ,CAAA;IACR,iFAAgB,CAAA;IAChB,iFAAgB,CAAA;IAChB,iGAAwB,CAAA;IACxB,2FAAqB,CAAA;AACzB,CAAC,EAPW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAO5B"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=paramOptions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"paramOptions.js","sourceRoot":"","sources":["../../../../src/reciple/types/paramOptions.ts"],"names":[],"mappings":""}
@@ -1,72 +0,0 @@
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.path = exports.createLogger = exports.validateCommandBuilder = exports.deprecationWarning = exports.isClass = void 0;
7
- const fallout_utility_1 = require("fallout-utility");
8
- const builders_1 = require("./types/builders");
9
- const flags_1 = require("./flags");
10
- const chalk_1 = __importDefault(require("chalk"));
11
- const path_1 = __importDefault(require("path"));
12
- /**
13
- * Check if an object is a class
14
- * @param object Object to identify
15
- */
16
- function isClass(object) {
17
- const isClassConstructor = object.constructor && object.constructor.toString().substring(0, 5) === 'class';
18
- if (object.prototype === undefined)
19
- return isClassConstructor;
20
- const isPrototypeClassConstructor = object.prototype.constructor && object.prototype.constructor.toString && object.prototype.constructor.toString().substring(0, 5) === 'class';
21
- return isClassConstructor || isPrototypeClassConstructor;
22
- }
23
- exports.isClass = isClass;
24
- /**
25
- * Emit process warning about deprecated method/function
26
- * @param content Warning content
27
- */
28
- function deprecationWarning(content) {
29
- process.emitWarning(content, 'DeprecationWarning');
30
- }
31
- exports.deprecationWarning = deprecationWarning;
32
- function validateCommandBuilder(command) {
33
- if (!command.name)
34
- return false;
35
- if (command.type === builders_1.CommandType.MessageCommand && command.options.length && command.options.some(o => !o.name))
36
- return false;
37
- return true;
38
- }
39
- exports.validateCommandBuilder = validateCommandBuilder;
40
- /**
41
- * Create new logger
42
- * @param stringifyJSON stringify json objects in console
43
- * @param debugmode display debug messages
44
- * @param colorizeMessage add logger colours to messages
45
- */
46
- function createLogger(stringifyJSON, debugmode = false, colorizeMessage = true) {
47
- return new fallout_utility_1.Logger({
48
- stringifyJSON: stringifyJSON,
49
- enableDebugMode: flags_1.flags.debugmode ?? debugmode,
50
- loggerName: 'Main',
51
- prefixes: {
52
- [fallout_utility_1.LogLevels.INFO]: (name) => `[${new Date().toLocaleTimeString(undefined, { hour12: false })}][${(name ? name + '/' : '') + 'INFO'}]`,
53
- [fallout_utility_1.LogLevels.WARN]: (name) => `[${chalk_1.default.yellow(new Date().toLocaleTimeString(undefined, { hour12: false }))}][${chalk_1.default.yellow((name ? name + '/' : '') + 'WARN')}]`,
54
- [fallout_utility_1.LogLevels.ERROR]: (name) => `[${chalk_1.default.red(new Date().toLocaleTimeString(undefined, { hour12: false }))}][${chalk_1.default.red((name ? name + '/' : '') + 'ERROR')}]`,
55
- [fallout_utility_1.LogLevels.DEBUG]: (name) => `[${chalk_1.default.blue(new Date().toLocaleTimeString(undefined, { hour12: false }))}][${chalk_1.default.blue((name ? name + '/' : '') + 'DEBUG')}]`,
56
- },
57
- formatMessages: {
58
- [fallout_utility_1.LogLevels.INFO]: (message) => message,
59
- [fallout_utility_1.LogLevels.WARN]: (message) => (!colorizeMessage ? message : chalk_1.default.yellow(message)),
60
- [fallout_utility_1.LogLevels.ERROR]: (message) => (!colorizeMessage ? message : chalk_1.default.red(message)),
61
- [fallout_utility_1.LogLevels.DEBUG]: (message) => (!colorizeMessage ? message : chalk_1.default.blue(message)),
62
- },
63
- ObjectInspectDepth: 3,
64
- ObjectInspectColorized: colorizeMessage,
65
- });
66
- }
67
- exports.createLogger = createLogger;
68
- /**
69
- * Path module that depending on os
70
- */
71
- exports.path = (0, fallout_utility_1.getOperatingSystem)() === fallout_utility_1.OS.WINDOWS ? path_1.default.win32 : path_1.default.posix;
72
- //# sourceMappingURL=util.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../../../src/reciple/util.ts"],"names":[],"mappings":";;;;;;AAAA,qDAA4E;AAC5E,+CAAkE;AAClE,mCAAgC;AAChC,kDAA0B;AAC1B,gDAAyB;AAEzB;;;GAGG;AACH,SAAgB,OAAO,CAAI,MAAW;IAClC,MAAM,kBAAkB,GAAG,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,OAAO,CAAC;IAC3G,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS;QAAE,OAAO,kBAAkB,CAAC;IAE9D,MAAM,2BAA2B,GAAG,MAAM,CAA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