reciple 9.4.1 → 9.5.1

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 (48) hide show
  1. package/README.md +11 -13
  2. package/dist/bin.js +2 -132
  3. package/dist/bin.js.map +1 -1
  4. package/dist/classes/CLI.d.ts +54 -0
  5. package/dist/classes/CLI.js +188 -0
  6. package/dist/classes/CLI.js.map +1 -0
  7. package/dist/classes/Config.d.ts +21 -51
  8. package/dist/classes/Config.js +54 -56
  9. package/dist/classes/Config.js.map +1 -1
  10. package/dist/classes/EventHandlers.d.ts +9 -0
  11. package/dist/classes/EventHandlers.js +71 -0
  12. package/dist/classes/EventHandlers.js.map +1 -0
  13. package/dist/classes/ModuleLoader.d.ts +25 -0
  14. package/dist/classes/ModuleLoader.js +95 -0
  15. package/dist/classes/ModuleLoader.js.map +1 -0
  16. package/dist/commands/init.d.ts +7 -0
  17. package/dist/commands/init.js +10 -0
  18. package/dist/commands/init.js.map +1 -0
  19. package/dist/commands/shard.d.ts +9 -0
  20. package/dist/commands/shard.js +101 -0
  21. package/dist/commands/shard.js.map +1 -0
  22. package/dist/commands/start.d.ts +9 -0
  23. package/dist/commands/start.js +94 -0
  24. package/dist/commands/start.js.map +1 -0
  25. package/dist/exports.d.ts +5 -9
  26. package/dist/exports.js +5 -3
  27. package/dist/exports.js.map +1 -1
  28. package/dist/index.d.ts +6 -4
  29. package/dist/index.js +3 -0
  30. package/dist/index.js.map +1 -1
  31. package/dist/types/constants.d.ts +6 -0
  32. package/dist/types/constants.js +29 -0
  33. package/dist/types/constants.js.map +1 -0
  34. package/dist/types/structures.d.ts +36 -0
  35. package/dist/types/structures.js +2 -0
  36. package/dist/types/structures.js.map +1 -0
  37. package/package.json +9 -5
  38. package/static/config.d.mts +3 -1
  39. package/static/config.mjs +7 -0
  40. package/dist/utils/cli.d.ts +0 -60
  41. package/dist/utils/cli.js +0 -80
  42. package/dist/utils/cli.js.map +0 -1
  43. package/dist/utils/logger.d.ts +0 -31
  44. package/dist/utils/logger.js +0 -87
  45. package/dist/utils/logger.js.map +0 -1
  46. package/dist/utils/modules.d.ts +0 -10
  47. package/dist/utils/modules.js +0 -44
  48. package/dist/utils/modules.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAQxC,eAAe,CAAC,OAAgB,EAAE,GAAQ,EAAE,EAAE,CAAC,OAAO;KACjD,OAAO,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;KACrC,WAAW,CAAC,gBAAgB,CAAC;KAC7B,MAAM,CAAC,4BAA4B,EAAE,4BAA4B,CAAC;KAClE,MAAM,CAAC,qBAAqB,EAAE,0BAA0B,EAAE,aAAa,CAAC;KACxE,kBAAkB,CAAC,IAAI,CAAC;KACxB,MAAM,CAAC,KAAK,IAAI,EAAE;IACf,IAAI,MAAM,GAAgB,GAAG,CAAC,MAAM,IAAI,IAAI,CAAC;IAE7C,MAAM,kBAAkB,GAAG,CAAC,GAAQ,EA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AK,CAAC,eAAe,CAAC,CAAC;IAE/B,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC;AACvE,CAAC,CAAC,CAAC"}
package/dist/exports.d.ts CHANGED
@@ -1,10 +1,6 @@
1
+ export * from './classes/CLI.js';
1
2
  export * from './classes/Config.js';
2
- export * from './utils/modules.js';
3
- export * from './utils/logger.js';
4
- export * from './utils/cli.js';
5
- export interface ProcessInformation {
6
- type: 'ProcessInfo';
7
- pid: number;
8
- threadId: number;
9
- log?: string;
10
- }
3
+ export * from './classes/EventHandlers.js';
4
+ export * from './classes/ModuleLoader.js';
5
+ export * from './types/constants.js';
6
+ export * from './types/structures.js';
package/dist/exports.js CHANGED
@@ -1,5 +1,7 @@
1
+ export * from './classes/CLI.js';
1
2
  export * from './classes/Config.js';
2
- export * from './utils/modules.js';
3
- export * from './utils/logger.js';
4
- export * from './utils/cli.js';
3
+ export * from './classes/EventHandlers.js';
4
+ export * from './classes/ModuleLoader.js';
5
+ export * from './types/constants.js';
6
+ export * from './types/structures.js';
5
7
  //# sourceMappingURL=exports.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"exports.js","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AACA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"exports.js","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAE1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- import { RecipleClient as Client, type Logger } from '@reciple/core';
2
- import type { RecipleConfig } from './classes/Config.js';
1
+ import type { Logger } from 'prtyprnt';
2
+ import type { CLI } from './classes/CLI.js';
3
+ import { RecipleClient as Client } from '@reciple/core';
4
+ import type { RecipleConfig } from './types/structures.js';
3
5
  export * from '@reciple/core';
4
6
  export * from './exports.js';
5
7
  export { config as loadEnv } from 'dotenv';
@@ -7,7 +9,7 @@ export declare class RecipleClient<Ready extends boolean = boolean> extends Clie
7
9
  readonly config: RecipleConfig;
8
10
  }
9
11
  declare global {
12
+ var cli: CLI;
13
+ var logger: Logger;
10
14
  var reciple: RecipleClient;
11
- var logger: Logger | undefined;
12
- var cli: typeof import('./utils/cli.js')['cli'];
13
15
  }
package/dist/index.js CHANGED
@@ -1,5 +1,8 @@
1
+ import { cli, logger } from './types/constants.js';
1
2
  import { RecipleClient as Client } from '@reciple/core';
2
3
  export * from '@reciple/core';
3
4
  export * from './exports.js';
5
+ global.cli = cli;
6
+ global.logger = logger;
4
7
  export { config as loadEnv } from 'dotenv';
5
8
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,MAAM,EAAe,MAAM,eAAe,CAAC;AAGrE,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,aAAa,IAAI,MAAM,EAAE,MAAM,eAAe,CAAC;AAGxD,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAE7B,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC;AACjB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;AAEvB,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { CLI } from '../classes/CLI.js';
2
+ import { Logger } from '@reciple/core';
3
+ export declare const cliBuildVersion: any;
4
+ export declare const cliVersion: string;
5
+ export declare const logger: Logger;
6
+ export declare const cli: CLI;
@@ -0,0 +1,29 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { CLI } from '../classes/CLI.js';
3
+ import path from 'node:path';
4
+ import { Command } from 'commander';
5
+ import { Logger } from '@reciple/core';
6
+ import { isDebugging } from 'fallout-utility';
7
+ import { coerce } from 'semver';
8
+ import { PackageUpdateChecker } from '@reciple/utils';
9
+ const packageJSON = JSON.parse(await readFile(path.join(CLI.root, './package.json'), 'utf-8'));
10
+ export const cliBuildVersion = packageJSON.version;
11
+ export const cliVersion = String(coerce(packageJSON.version));
12
+ export const logger = new Logger({
13
+ debugmode: {
14
+ enabled: isDebugging()
15
+ }
16
+ });
17
+ export const cli = new CLI({
18
+ packageJSON,
19
+ binPath: path.join(CLI.root, './dist/bin.js'),
20
+ commander: new Command(),
21
+ processCwd: process.cwd(),
22
+ logger: logger.clone({
23
+ label: 'CLI'
24
+ }),
25
+ updateChecker: new PackageUpdateChecker({
26
+ packages: []
27
+ })
28
+ });
29
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/types/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEtD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,gBAAgB,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;AAE/F,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAC,OAAO,CAAC;AACnD,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;AAE9D,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC;IAC7B,SAAS,EAAE;QACP,OAAO,EAAE,WAAW,EAAE;KACzB;CACJ,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC;IACvB,WAAW;IACX,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,eAAe,CAAC;IAC7C,SAAS,EAAE,IAAI,OAAO,EAAE;IACxB,UAAU,EAAE,OAAO,CAAC,GAAG,EAAE;IACzB,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC;QACjB,KAAK,EAAE,KAAK;KACf,CAAC;IACF,aAAa,EAAE,IAAI,oBAAoB,CAAC;QACpC,QAAQ,EAAE,EAAE;KACf,CAAC;CACL,CAAC,CAAC"}
@@ -0,0 +1,36 @@
1
+ import type { Logger, RecipleClientConfig } from '@reciple/core';
2
+ import type { Awaitable } from 'discord.js';
3
+ export interface CLIDefaultFlags {
4
+ cwd: string;
5
+ env: string[];
6
+ debug: boolean;
7
+ production: boolean;
8
+ }
9
+ export interface RecipleConfig extends RecipleClientConfig {
10
+ logger?: {
11
+ enabled: boolean;
12
+ debugmode?: boolean | null;
13
+ coloredMessages: boolean;
14
+ disableLogPrefix: boolean;
15
+ logToFile: {
16
+ enabled: boolean;
17
+ logsFolder: string;
18
+ file: string;
19
+ };
20
+ } | Logger;
21
+ modules?: {
22
+ dirs: string[];
23
+ exclude?: string[];
24
+ filter?: (file: string) => Awaitable<boolean>;
25
+ sort?: (a: string, b: string) => number;
26
+ disableModuleVersionCheck?: boolean;
27
+ };
28
+ checkForUpdates?: boolean;
29
+ version?: string;
30
+ }
31
+ export interface ProcessInformation {
32
+ type: 'ProcessInfo';
33
+ pid: number;
34
+ threadId: number;
35
+ log?: string;
36
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=structures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structures.js","sourceRoot":"","sources":["../../src/types/structures.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Reciple is a Discord.js bot framework",
4
4
  "homepage": "https://reciple.js.org/docs/reciple",
5
5
  "license": "GPL-3.0",
6
- "version": "9.4.1",
6
+ "version": "9.5.1",
7
7
  "module": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
9
9
  "bin": "./dist/bin.js",
@@ -42,17 +42,21 @@
42
42
  "README.md"
43
43
  ],
44
44
  "dependencies": {
45
- "@reciple/utils": "^9.3.1",
45
+ "@reciple/utils": "^9.3.2",
46
+ "ansi-regex": "^6.0.1",
47
+ "chokidar": "^3.6.0",
46
48
  "commander": "^12.1.0",
47
49
  "dotenv": "^16.4.5",
48
50
  "fallout-utility": "^2.9.1",
49
51
  "globby": "^14.0.2",
50
52
  "micromatch": "^4.0.7",
53
+ "nodemon": "^3.1.4",
51
54
  "prompts": "^2.4.2",
52
- "semver": "^7.6.2"
55
+ "prtyprnt": "^1.1.0",
56
+ "semver": "^7.6.3"
53
57
  },
54
58
  "devDependencies": {
55
- "@reciple/core": "^9.4.1",
59
+ "@reciple/core": "^9.5.0",
56
60
  "@types/micromatch": "^4.0.9",
57
61
  "@types/semver": "^7.5.8",
58
62
  "discord.js": "^14.15.3"
@@ -61,5 +65,5 @@
61
65
  "@reciple/core": "^9 || ^9.0.0-dev",
62
66
  "discord.js": "^14.15.0"
63
67
  },
64
- "gitHead": "3fe782efc95738becd5d0ebd34b5ec8553557a75"
68
+ "gitHead": "e051d81301cf14c2a8e3dd32f87640a25ad4d59e"
65
69
  }
@@ -1,3 +1,5 @@
1
- import { RecipleConfig } from 'reciple';
1
+ import { RecipleConfig, type RecipleConfigJS } from 'reciple';
2
2
 
3
3
  export const config: RecipleConfig;
4
+
5
+ export const sharding: RecipleConfigJS['sharding'];
package/static/config.mjs CHANGED
@@ -77,3 +77,10 @@ export const config = {
77
77
  checkForUpdates: true,
78
78
  version: `^${cliVersion}`
79
79
  };
80
+
81
+ /**
82
+ * @satisfies {import('reciple').RecipleConfigJS['sharding']}
83
+ */
84
+ export const sharding = {
85
+ mode: 'process'
86
+ }
@@ -1,60 +0,0 @@
1
- import { PackageUpdateChecker } from '@reciple/utils';
2
- import { Command } from 'commander';
3
- export declare let command: Command;
4
- export interface CLIOptions {
5
- version?: string;
6
- token?: string;
7
- config?: string;
8
- debugmode?: boolean;
9
- yes?: boolean;
10
- env?: string;
11
- shardmode?: boolean;
12
- setup?: boolean;
13
- [k: string]: any;
14
- }
15
- export declare const cli: {
16
- /**
17
- * This property returns the command-line arguments passed to the CLI. It is an array of strings, where each string represents an argument.
18
- */
19
- readonly args: string[];
20
- /**
21
- * This property returns the command-line options passed to the CLI. It is an object with keys and values depending on the options specified in the command-line arguments.
22
- */
23
- readonly options: CLIOptions;
24
- /**
25
- * This property returns the current working directory (CWD) of the CLI. It takes into account the command-line arguments passed to the CLI.
26
- */
27
- readonly cwd: string;
28
- /**
29
- * This property returns a boolean value indicating whether shard mode is enabled or not.
30
- * It is enabled if the shardmode option is specified in the command-line arguments, or if the `SHARDMODE` environment variable is set to `1`. Otherwise, it is disabled.
31
- */
32
- readonly shardmode: boolean;
33
- /**
34
- * This property returns the thread ID of the current thread, if it is not the main thread.
35
- */
36
- threadId: number | undefined;
37
- /**
38
- * This property is used to store a boolean value indicating whether the CWD has been updated or not.
39
- */
40
- isCwdUpdated: boolean;
41
- /**
42
- * This property returns the current working directory of the Node.js process.
43
- */
44
- nodeCwd: string;
45
- /**
46
- * This property returns the path of the bin.mjs file, which is the main entry point of the CLI.
47
- */
48
- binPath: string;
49
- /**
50
- * Reciple package root directory
51
- */
52
- reciplePackagePath: string;
53
- /**
54
- * This property is used to store the path of the log file.
55
- */
56
- logPath: string | undefined;
57
- };
58
- export declare const cliVersion: string;
59
- export declare const cliBuildVersion: any;
60
- export declare const updateChecker: PackageUpdateChecker;
package/dist/utils/cli.js DELETED
@@ -1,80 +0,0 @@
1
- import { isMainThread, parentPort, threadId } from 'node:worker_threads';
2
- import { PackageUpdateChecker } from '@reciple/utils';
3
- import { buildVersion } from '@reciple/core';
4
- import { fileURLToPath } from 'node:url';
5
- import { readFileSync } from 'node:fs';
6
- import { Command } from 'commander';
7
- import { coerce } from 'semver';
8
- import path from 'node:path';
9
- const { version, description } = JSON.parse(readFileSync(path.join(path.dirname(fileURLToPath(import.meta.url)), '../../package.json'), 'utf-8'));
10
- const originalCwd = process.cwd();
11
- export let command = new Command()
12
- .name('reciple')
13
- .description(description)
14
- .version(`Reciple CLI: ${version}\nReciple Client: ${buildVersion}`, '-v, --version')
15
- .argument('[cwd]', 'Change the current working directory')
16
- .option('-t, --token <token>', 'Replace used bot token')
17
- .option('-c, --config <dir>', 'Set path to a config file')
18
- .option('-D, --debugmode', 'Enable debug mode')
19
- .option('-y, --yes', 'Agree to all Reciple confirmation prompts')
20
- .option('--env <file>', '.env file location')
21
- .option('--shardmode', 'Modifies some functionalities to support sharding')
22
- .option('--setup', 'Create required config without starting the bot')
23
- .allowUnknownOption(true);
24
- export const cli = {
25
- /**
26
- * This property returns the command-line arguments passed to the CLI. It is an array of strings, where each string represents an argument.
27
- */
28
- get args() { return command.args; },
29
- /**
30
- * This property returns the command-line options passed to the CLI. It is an object with keys and values depending on the options specified in the command-line arguments.
31
- */
32
- get options() { return command.opts(); },
33
- /**
34
- * This property returns the current working directory (CWD) of the CLI. It takes into account the command-line arguments passed to the CLI.
35
- */
36
- get cwd() {
37
- return this.args[0]
38
- ? path.isAbsolute(this.args[0]) ? this.args[0] : path.join(originalCwd, this.args[0])
39
- : process.cwd();
40
- },
41
- /**
42
- * This property returns a boolean value indicating whether shard mode is enabled or not.
43
- * It is enabled if the shardmode option is specified in the command-line arguments, or if the `SHARDMODE` environment variable is set to `1`. Otherwise, it is disabled.
44
- */
45
- get shardmode() { return !!(this.options.shardmode ?? process.env.SHARDMODE); },
46
- /**
47
- * This property returns the thread ID of the current thread, if it is not the main thread.
48
- */
49
- threadId: !isMainThread && parentPort !== undefined ? threadId : undefined,
50
- /**
51
- * This property is used to store a boolean value indicating whether the CWD has been updated or not.
52
- */
53
- isCwdUpdated: false,
54
- /**
55
- * This property returns the current working directory of the Node.js process.
56
- */
57
- nodeCwd: process.cwd(),
58
- /**
59
- * This property returns the path of the bin.mjs file, which is the main entry point of the CLI.
60
- */
61
- binPath: path.join(path.dirname(fileURLToPath(import.meta.url)), '../bin.mjs'),
62
- /**
63
- * Reciple package root directory
64
- */
65
- reciplePackagePath: path.join(path.dirname(fileURLToPath(import.meta.url)), '../../'),
66
- /**
67
- * This property is used to store the path of the log file.
68
- */
69
- logPath: undefined
70
- };
71
- global.cli = cli;
72
- export const cliVersion = `${coerce(version)}`;
73
- export const cliBuildVersion = version;
74
- export const updateChecker = new PackageUpdateChecker({
75
- packages: [
76
- { package: 'reciple', currentVersion: cliBuildVersion },
77
- { package: '@reciple/core', currentVersion: buildVersion }
78
- ]
79
- });
80
- //# sourceMappingURL=cli.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/utils/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;A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,GAAG,GAAG,GAAG,CAAC;AAEjB,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;AAC/C,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAC;AACvC,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,oBAAoB,CAAC;IAClD,QAAQ,EAAE;QACN,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,eAAe,EAAE;QACvD,EAAE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,YAAY,EAAE;KAC7D;CACJ,CAAC,CAAC"}
@@ -1,31 +0,0 @@
1
- import { Logger, LoggerLevel, type PartialDeep } from 'fallout-utility';
2
- import type { RecipleConfig } from '../classes/Config.js';
3
- import { type RecipleClient } from '../index.js';
4
- /**
5
- * Formats a log message with optional prefix, colored messages, and thread information.
6
- *
7
- * @param {string} message - The log message to format.
8
- * @param {Logger} logger - The logger instance used to get the logger name.
9
- * @param {PartialDeep<Exclude<RecipleConfig['logger'], Logger|undefined>> & { shards?: boolean; }} config - The logger configuration.
10
- * @param {LoggerLevel} level - The log level.
11
- * @return {string} The formatted log message.
12
- */
13
- export declare function formatLogMessage(message: string, logger: Logger, config: PartialDeep<Exclude<RecipleConfig['logger'], Logger | undefined>> & {
14
- shards?: boolean;
15
- }, level: LoggerLevel): string;
16
- /**
17
- * Creates a logger with the specified configuration.
18
- *
19
- * @param {Omit<PartialDeep<Exclude<RecipleConfig['logger'], Logger|undefined>>, 'enabled'> & { shards?: boolean; }} config - The configuration for the logger.
20
- * @return {Promise<Logger>} The created logger instance.
21
- */
22
- export declare function createLogger(config?: Omit<PartialDeep<Exclude<RecipleConfig['logger'], Logger | undefined>>, 'enabled'> & {
23
- shards?: boolean;
24
- }): Promise<Logger>;
25
- /**
26
- * Adds event listeners to the client for various module events and reciple events.
27
- *
28
- * @param {RecipleClient} client - The client to add the event listeners to.
29
- * @return {void} This function does not return anything.
30
- */
31
- export declare function addEventListenersToClient(client: RecipleClient): void;
@@ -1,87 +0,0 @@
1
- import { Logger, LoggerLevel, kleur } from 'fallout-utility';
2
- import {} from '../index.js';
3
- import { RecipleModule } from '@reciple/core';
4
- import { cli } from './cli.js';
5
- import path from 'node:path';
6
- /**
7
- * Formats a log message with optional prefix, colored messages, and thread information.
8
- *
9
- * @param {string} message - The log message to format.
10
- * @param {Logger} logger - The logger instance used to get the logger name.
11
- * @param {PartialDeep<Exclude<RecipleConfig['logger'], Logger|undefined>> & { shards?: boolean; }} config - The logger configuration.
12
- * @param {LoggerLevel} level - The log level.
13
- * @return {string} The formatted log message.
14
- */
15
- export function formatLogMessage(message, logger, config, level) {
16
- const color = (msg) => {
17
- if (!config.coloredMessages || level === LoggerLevel.INFO)
18
- return msg;
19
- switch (level) {
20
- case LoggerLevel.WARN:
21
- return kleur.yellow(msg);
22
- case LoggerLevel.ERROR:
23
- return kleur.red(msg);
24
- case LoggerLevel.DEBUG:
25
- return kleur.cyan(msg);
26
- default:
27
- return msg;
28
- }
29
- };
30
- return (!config.disableLogPrefix
31
- ? color(`[${new Date().toLocaleTimeString(undefined, { hour12: false })} ${LoggerLevel[level]}]` +
32
- (config?.shards ?? cli.shardmode ? `[${cli.threadId ?? process.pid}]` : '') +
33
- (logger.name ? `[${logger.name}]` : ''))
34
- : '') + ` ${message}`;
35
- }
36
- /**
37
- * Creates a logger with the specified configuration.
38
- *
39
- * @param {Omit<PartialDeep<Exclude<RecipleConfig['logger'], Logger|undefined>>, 'enabled'> & { shards?: boolean; }} config - The configuration for the logger.
40
- * @return {Promise<Logger>} The created logger instance.
41
- */
42
- export async function createLogger(config) {
43
- const logger = new Logger({
44
- enableDebugmode: (cli.options.debugmode || config?.debugmode) ?? null,
45
- forceEmitLogEvents: true,
46
- formatMessage: (message, level, logger) => formatLogMessage(message, logger, config ?? {}, level)
47
- });
48
- const shards = config?.shards ?? cli.shardmode;
49
- const file = path.join(shards && typeof process.env.SHARDS_LOGS_FOLDER === 'string'
50
- ? process.env.SHARDS_LOGS_FOLDER
51
- : path.join(process.cwd(), config?.logToFile?.logsFolder ? config.logToFile?.logsFolder : 'logs'), !shards
52
- ? (config?.logToFile?.file ?? 'latest.log')
53
- : `shard-${(cli.threadId !== undefined ? (cli.threadId + '-') : '') + process.pid}.log`);
54
- if (config?.logToFile?.enabled) {
55
- await logger.createFileWriteStream({ file });
56
- cli.logPath = file;
57
- }
58
- return logger;
59
- }
60
- /**
61
- * Adds event listeners to the client for various module events and reciple events.
62
- *
63
- * @param {RecipleClient} client - The client to add the event listeners to.
64
- * @return {void} This function does not return anything.
65
- */
66
- export function addEventListenersToClient(client) {
67
- client.on('recipleDebug', debug => client.logger?.debug(debug));
68
- client.modules.on('resolveModuleFileError', (file, error) => client.logger?.err(`Failed to resolve module ${kleur.yellow(quoteString(file))}:`, error));
69
- client.modules.on('preStartModule', (m) => {
70
- if (!RecipleModule.getModuleRoot(m))
71
- Reflect.set(m, 'root', cli.cwd);
72
- client.logger?.debug(`Starting module ${kleur.cyan(quoteString(m.displayName))}`);
73
- });
74
- client.modules.on('postStartModule', (m) => client.logger?.log(`Started module ${kleur.cyan(quoteString(m.displayName))}`));
75
- client.modules.on('startModuleError', (m, err) => client.logger?.error(`Failed to start module ${kleur.yellow(quoteString(m.displayName))}:`, err));
76
- client.modules.on('preLoadModule', (m) => client.logger?.debug(`Loading module ${kleur.cyan(quoteString(m.displayName))}`));
77
- client.modules.on('postLoadModule', (m) => client.logger?.log(`Loaded module ${kleur.cyan(quoteString(m.displayName))}`));
78
- client.modules.on('loadModuleError', (m, err) => client.logger?.error(`Failed to load module ${kleur.yellow(quoteString(m.displayName))}:`, err));
79
- client.modules.on('preUnloadModule', (m) => client.logger?.debug(`Unloading module ${kleur.cyan(quoteString(m.displayName))}`));
80
- client.modules.on('postUnloadModule', (m) => client.logger?.log(`Unloaded module ${kleur.cyan(quoteString(m.displayName))}`));
81
- client.modules.on('unloadModuleError', (m, err) => client.logger?.error(`Failed to unload module ${kleur.yellow(quoteString(m.displayName))}:`, err));
82
- client.on('recipleRegisterApplicationCommands', (commands, guild) => client.logger?.log(`Registered (${commands?.size || 0}) application commands ${guild ? 'to ' + guild : 'globally'}`));
83
- }
84
- function quoteString(string, quote = "'") {
85
- return `${quote}${string}${quote}`;
86
- }
87
- //# sourceMappingURL=logger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAoB,MAAM,iBAAiB,CAAC;AAE/E,OAAO,EAAsB,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe,EAAE,MAAc,EAAE,MAA+F,EAAE,KAAkB;IACjL,MAAM,KAAK,GAAG,CAAC,GAAW,EAAE,EAAE;QAC1B,IAAI,CAAC,MAAM,CAAC,eAAe,IAAI,KAAK,KAAK,WAAW,CAAC,IAAI;YAAE,OAAO,GAAG,CAAC;QAEtE,QAAQ,KAAK,EAAE,CAAC;YACZ,KAAK,WAAW,CAAC,IAAI;gBACjB,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7B,KAAK,WAAW,CAAC,KAAK;gBAClB,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC1B,KAAK,WAAW,CAAC,KAAK;gBAClB,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC3B;gBACI,OAAO,GAAG,CAAC;QACnB,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,CAAC,CAAC,MAAM,CAAC,gBAAgB;QACpB,CAAC,CAAC,KAAK,CACC,IAAI,IAAI,IAAI,EAAE,CAAC,kB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AAC,CAAC;IAElJ,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,iBAAiB,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,oBAAoB,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAChI,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,kBAAkB,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,mBAAmB,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9H,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,2BAA2B,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IAEtJ,MAAM,CAAC,EAAE,CAAC,oCAAoC,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,eAAe,QAAQ,EAAE,IAAI,IAAI,CAAC,0BAA0B,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;AAC/L,CAAC;AAED,SAAS,WAAW,CAAC,MAAc,EAAE,QAAgB,GAAG;IACpD,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,EAAE,CAAC;AACvC,CAAC"}
@@ -1,10 +0,0 @@
1
- import type { RecipleConfig } from '../classes/Config.js';
2
- import type { Awaitable } from 'fallout-utility/types';
3
- /**
4
- * Recursively finds modules in specified directories based on the given configuration.
5
- *
6
- * @param {RecipleConfig['modules']} config - The configuration object containing directories and filters.
7
- * @param {((filename: string) => Awaitable<boolean>)?} filter - An optional function to filter files.
8
- * @return {Promise<string[]>} A promise that resolves to an array of module file paths.
9
- */
10
- export declare function findModules(config: RecipleConfig['modules'], filter?: (filename: string) => Awaitable<boolean>): Promise<string[]>;
@@ -1,44 +0,0 @@
1
- import { lstat, mkdir, readdir } from 'node:fs/promises';
2
- import { existsAsync } from '@reciple/utils';
3
- import micromatch from 'micromatch';
4
- import path from 'node:path';
5
- /**
6
- * Recursively finds modules in specified directories based on the given configuration.
7
- *
8
- * @param {RecipleConfig['modules']} config - The configuration object containing directories and filters.
9
- * @param {((filename: string) => Awaitable<boolean>)?} filter - An optional function to filter files.
10
- * @return {Promise<string[]>} A promise that resolves to an array of module file paths.
11
- */
12
- export async function findModules(config, filter) {
13
- const modules = [];
14
- const { globby, isDynamicPattern } = await import('globby');
15
- for (const folder of config?.dirs ?? []) {
16
- const dir = path.isAbsolute(folder) ? folder : path.join(process.cwd(), folder);
17
- if (isDynamicPattern(folder, { cwd: process.cwd() })) {
18
- let dirs = await globby(folder, {
19
- cwd: process.cwd(),
20
- onlyDirectories: true,
21
- absolute: true
22
- });
23
- if (config?.exclude?.length)
24
- dirs = dirs.filter(f => !micromatch.isMatch(path.basename(f), config.exclude));
25
- modules.push(...await findModules({
26
- ...config,
27
- dirs
28
- }));
29
- continue;
30
- }
31
- if (!await existsAsync(dir))
32
- await mkdir(dir, { recursive: true });
33
- if (!(await lstat(dir)).isDirectory())
34
- continue;
35
- const files = (await readdir(dir))
36
- .map(file => path.join(dir, file))
37
- .filter(f => !config?.exclude?.length || !micromatch.isMatch(path.basename(f), config.exclude))
38
- .filter(file => (filter ? filter(file) : file.endsWith('.js')));
39
- const addFile = async (file) => !config?.filter || await Promise.resolve(config.filter(file)) ? modules.push(file) : 0;
40
- await Promise.all(files.map(f => addFile(f)));
41
- }
42
- return modules;
43
- }
44
- //# sourceMappingURL=modules.js.map
@@ -1 +0,0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