reciple 6.0.0-dev.9 → 6.0.2

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 (91) hide show
  1. package/LICENSE +674 -674
  2. package/README.md +182 -183
  3. package/dist/lib/bin.mjs +77 -0
  4. package/dist/lib/bin.mjs.map +1 -0
  5. package/dist/lib/esm.mjs +2 -0
  6. package/dist/lib/esm.mjs.map +1 -0
  7. package/dist/{cjs → lib}/index.js +17 -17
  8. package/dist/lib/index.js.map +1 -0
  9. package/dist/{cjs → lib}/reciple/classes/RecipleClient.js +43 -29
  10. package/dist/lib/reciple/classes/RecipleClient.js.map +1 -0
  11. package/dist/{cjs → lib}/reciple/classes/RecipleConfig.js +11 -10
  12. package/dist/lib/reciple/classes/RecipleConfig.js.map +1 -0
  13. package/dist/{cjs → lib}/reciple/classes/RecipleModule.js +58 -15
  14. package/dist/lib/reciple/classes/RecipleModule.js.map +1 -0
  15. package/dist/{cjs → lib}/reciple/classes/builders/MessageCommandBuilder.js +150 -82
  16. package/dist/lib/reciple/classes/builders/MessageCommandBuilder.js.map +1 -0
  17. package/dist/{cjs → lib}/reciple/classes/builders/MessageCommandOptionBuilder.js +55 -13
  18. package/dist/lib/reciple/classes/builders/MessageCommandOptionBuilder.js.map +1 -0
  19. package/dist/{cjs → lib}/reciple/classes/builders/SlashCommandBuilder.js +41 -10
  20. package/dist/lib/reciple/classes/builders/SlashCommandBuilder.js.map +1 -0
  21. package/dist/{cjs → lib}/reciple/classes/managers/ApplicationCommandManager.js +49 -6
  22. package/dist/lib/reciple/classes/managers/ApplicationCommandManager.js.map +1 -0
  23. package/dist/{cjs → lib}/reciple/classes/managers/CommandCooldownManager.js +1 -1
  24. package/dist/lib/reciple/classes/managers/CommandCooldownManager.js.map +1 -0
  25. package/dist/{cjs/reciple/classes/managers/ClientCommandManager.js → lib/reciple/classes/managers/CommandManager.js} +16 -13
  26. package/dist/lib/reciple/classes/managers/CommandManager.js.map +1 -0
  27. package/dist/{cjs → lib}/reciple/classes/managers/MessageCommandOptionManager.js +1 -0
  28. package/dist/lib/reciple/classes/managers/MessageCommandOptionManager.js.map +1 -0
  29. package/dist/{cjs/reciple/classes/managers/ClientModuleManager.js → lib/reciple/classes/managers/ModuleManager.js} +78 -64
  30. package/dist/lib/reciple/classes/managers/ModuleManager.js.map +1 -0
  31. package/dist/{cjs → lib}/reciple/flags.js +4 -3
  32. package/dist/lib/reciple/flags.js.map +1 -0
  33. package/dist/{cjs → lib}/reciple/permissions.js +1 -0
  34. package/dist/lib/reciple/permissions.js.map +1 -0
  35. package/dist/{cjs → lib}/reciple/types/builders.js +2 -1
  36. package/dist/lib/reciple/types/builders.js.map +1 -0
  37. package/dist/{cjs → lib}/reciple/types/commands.js +7 -6
  38. package/dist/lib/reciple/types/commands.js.map +1 -0
  39. package/dist/{cjs → lib}/reciple/types/paramOptions.js +1 -0
  40. package/dist/lib/reciple/types/paramOptions.js.map +1 -0
  41. package/dist/{cjs → lib}/reciple/util.js +13 -7
  42. package/dist/lib/reciple/util.js.map +1 -0
  43. package/dist/{cjs → lib}/reciple/version.js +1 -1
  44. package/dist/lib/reciple/version.js.map +1 -0
  45. package/dist/types/{bin.d.ts → bin.d.mts} +1 -0
  46. package/dist/types/bin.d.mts.map +1 -0
  47. package/dist/types/esm.d.mts +2 -0
  48. package/dist/types/esm.d.mts.map +1 -0
  49. package/dist/types/index.d.ts +17 -17
  50. package/dist/types/index.d.ts.map +1 -0
  51. package/dist/types/reciple/classes/RecipleClient.d.ts +23 -8
  52. package/dist/types/reciple/classes/RecipleClient.d.ts.map +1 -0
  53. package/dist/types/reciple/classes/RecipleConfig.d.ts +5 -2
  54. package/dist/types/reciple/classes/RecipleConfig.d.ts.map +1 -0
  55. package/dist/types/reciple/classes/RecipleModule.d.ts +37 -5
  56. package/dist/types/reciple/classes/RecipleModule.d.ts.map +1 -0
  57. package/dist/types/reciple/classes/builders/MessageCommandBuilder.d.ts +70 -26
  58. package/dist/types/reciple/classes/builders/MessageCommandBuilder.d.ts.map +1 -0
  59. package/dist/types/reciple/classes/builders/MessageCommandOptionBuilder.d.ts +18 -7
  60. package/dist/types/reciple/classes/builders/MessageCommandOptionBuilder.d.ts.map +1 -0
  61. package/dist/types/reciple/classes/builders/SlashCommandBuilder.d.ts +25 -10
  62. package/dist/types/reciple/classes/builders/SlashCommandBuilder.d.ts.map +1 -0
  63. package/dist/types/reciple/classes/managers/ApplicationCommandManager.d.ts +45 -6
  64. package/dist/types/reciple/classes/managers/ApplicationCommandManager.d.ts.map +1 -0
  65. package/dist/types/reciple/classes/managers/CommandCooldownManager.d.ts +1 -0
  66. package/dist/types/reciple/classes/managers/CommandCooldownManager.d.ts.map +1 -0
  67. package/dist/types/reciple/classes/managers/CommandManager.d.ts +35 -0
  68. package/dist/types/reciple/classes/managers/CommandManager.d.ts.map +1 -0
  69. package/dist/types/reciple/classes/managers/MessageCommandOptionManager.d.ts +2 -1
  70. package/dist/types/reciple/classes/managers/MessageCommandOptionManager.d.ts.map +1 -0
  71. package/dist/types/reciple/classes/managers/ModuleManager.d.ts +50 -0
  72. package/dist/types/reciple/classes/managers/ModuleManager.d.ts.map +1 -0
  73. package/dist/types/reciple/flags.d.ts +2 -1
  74. package/dist/types/reciple/flags.d.ts.map +1 -0
  75. package/dist/types/reciple/permissions.d.ts +3 -6
  76. package/dist/types/reciple/permissions.d.ts.map +1 -0
  77. package/dist/types/reciple/types/builders.d.ts +25 -16
  78. package/dist/types/reciple/types/builders.d.ts.map +1 -0
  79. package/dist/types/reciple/types/commands.d.ts +20 -15
  80. package/dist/types/reciple/types/commands.d.ts.map +1 -0
  81. package/dist/types/reciple/types/paramOptions.d.ts +80 -3
  82. package/dist/types/reciple/types/paramOptions.d.ts.map +1 -0
  83. package/dist/types/reciple/util.d.ts +9 -2
  84. package/dist/types/reciple/util.d.ts.map +1 -0
  85. package/dist/types/reciple/version.d.ts +1 -0
  86. package/dist/types/reciple/version.d.ts.map +1 -0
  87. package/package.json +44 -35
  88. package/resource/reciple.yml +27 -22
  89. package/dist/cjs/bin.js +0 -54
  90. package/dist/types/reciple/classes/managers/ClientCommandManager.d.ts +0 -37
  91. package/dist/types/reciple/classes/managers/ClientModuleManager.d.ts +0 -19
package/package.json CHANGED
@@ -1,18 +1,29 @@
1
1
  {
2
2
  "name": "reciple",
3
- "version": "6.0.0-dev.9",
4
- "bin": "./dist/cjs/bin.js",
3
+ "type": "commonjs",
5
4
  "license": "GPL-3.0",
6
- "main": "./dist/cjs/index.js",
7
- "types": "./dist/types/index.d.ts",
8
- "module": "./dist/mjs/index.js",
5
+ "engineStrict": true,
6
+ "version": "6.0.2",
9
7
  "author": "FalloutStudios",
10
- "description": "Handler for Discord.js",
8
+ "main": "./dist/lib/index.js",
9
+ "module": "./dist/lib/esm.mjs",
10
+ "types": "./dist/types/index.d.ts",
11
+ "description": "A simple Discord.js handler that just works",
11
12
  "homepage": "https://reciple.js.org",
13
+ "bin": {
14
+ "reciple": "./dist/lib/bin.mjs"
15
+ },
12
16
  "exports": {
13
- "require": "./dist/cjs/index.js",
14
- "import": "./dist/mjs/index.js",
15
- "types": "./dist/types/index.d.ts"
17
+ ".": {
18
+ "import": {
19
+ "types": "./dist/types/index.d.ts",
20
+ "default": "./dist/lib/esm.mjs"
21
+ },
22
+ "require": {
23
+ "types": "./dist/types/index.d.ts",
24
+ "default": "./dist/lib/index.js"
25
+ }
26
+ }
16
27
  },
17
28
  "keywords": [
18
29
  "Discord",
@@ -25,54 +36,52 @@
25
36
  "bugs": {
26
37
  "url": "https://github.com/FalloutStudios/reciple/issues"
27
38
  },
39
+ "engines": {
40
+ "node": ">=16.9.0"
41
+ },
42
+ "workspaces": [
43
+ "test"
44
+ ],
45
+ "files": [
46
+ "dist",
47
+ "resource",
48
+ "LICENSE",
49
+ "README.md"
50
+ ],
28
51
  "scripts": {
29
52
  "format": "npx prettier --write src",
30
53
  "clean": "npx rimraf dist",
31
54
  "build": "npm run clean && npx tsc",
32
- "build:publish": "npm run format && npm run build && npx docs && npm publish",
55
+ "build:publish": "npm run format && npm run build && npm run docs && npm publish",
33
56
  "build:publish-dev": "npm run format && npm run build && npm publish --tag dev",
34
- "test": "npm run build && npm run start -w test",
57
+ "test": "npm run build && npm install && npm run start -w test",
35
58
  "docs": "npx docgen --typescript true -c ./docs/index.json -o ./docs/docs.json -i src/index.ts",
36
- "watch": "npx tsc --watch --noEmit",
37
- "husky:install": "npx husky install"
59
+ "watch": "npx tsc --watch --noEmit"
38
60
  },
39
61
  "repository": {
40
62
  "type": "git",
41
63
  "url": "git+https://github.com/FalloutStudios/reciple.git"
42
64
  },
43
- "engineStrict": true,
44
- "engines": {
45
- "node": ">=16.9.0"
46
- },
47
- "files": [
48
- "dist",
49
- "resource",
50
- "LICENSE",
51
- "README.md"
52
- ],
53
65
  "dependencies": {
54
66
  "chalk": "4.1.2",
55
67
  "commander": "^9.4.1",
56
68
  "dotenv": "^16.0.3",
57
- "fallout-utility": "^1.5.4",
69
+ "fallout-utility": "^1.5.21",
70
+ "micromatch": "^4.0.5",
58
71
  "semver": "^7.3.7",
59
- "wildcard-match": "^5.1.2",
60
72
  "yaml": "^2.1.1"
61
73
  },
62
74
  "devDependencies": {
63
75
  "@discordjs/docgen": "^0.12.1",
64
- "@types/node": "^18.11.0",
65
- "@types/semver": "^7.3.12",
66
- "discord.js": "^14.6.0",
67
- "husky": "^8.0.1",
68
- "prettier": "2.7.1",
76
+ "@types/micromatch": "^4.0.2",
77
+ "@types/node": "^18.11.9",
78
+ "@types/semver": "^7.3.13",
79
+ "discord.js": "^14.7.0",
80
+ "prettier": "^2.8.0",
69
81
  "rimraf": "^3.0.2",
70
- "typescript": "^4.8.4"
82
+ "typescript": "^4.9.3"
71
83
  },
72
84
  "peerDependencies": {
73
85
  "discord.js": "^14.5.0"
74
- },
75
- "workspaces": [
76
- "test"
77
- ]
86
+ }
78
87
  }
@@ -4,20 +4,26 @@ token: TOKEN
4
4
 
5
5
  # Commands options
6
6
  commands:
7
- # message command options
8
- messageCommand:
9
- # enable message commands
7
+ # Interaction command options
8
+ slashCommand:
9
+ # enable interaction commands
10
10
  enabled: true
11
- # command prefix
12
- prefix: '!'
13
11
  # reply when an error occured
14
12
  replyOnError: false
15
13
  # enable the use of command cooldowns
16
14
  enableCooldown: true
17
- # allow executing commands via aliases
18
- allowCommandAlias: true
19
- # command argument separator
20
- commandArgumentSeparator: ' '
15
+ # register interaction commands on bot ready
16
+ registerCommands: true
17
+ # allow register empty list of application commands
18
+ allowRegisterEmptyCommandList: true
19
+ # set required permissions for interaction commands
20
+ setRequiredPermissions: true
21
+ # accept replied or deffered command interaction
22
+ acceptRepliedInteractions: false
23
+ # legacy permissions checking
24
+ useLegacyPermissionsChecking: false
25
+ # register commands to specific guild(s) empty to make it global
26
+ guilds: []
21
27
  # overwrite command permissions
22
28
  permissions:
23
29
  # enable overwriten command permissions
@@ -27,22 +33,20 @@ commands:
27
33
  permissions:
28
34
  - Administrator
29
35
 
30
- # Interaction command options
31
- slashCommand:
32
- # enable interaction commands
36
+ # message command options
37
+ messageCommand:
38
+ # enable message commands
33
39
  enabled: true
40
+ # command prefix
41
+ prefix: '!'
34
42
  # reply when an error occured
35
43
  replyOnError: false
36
44
  # enable the use of command cooldowns
37
45
  enableCooldown: true
38
- # register interaction commands on bot ready
39
- registerCommands: true
40
- # set required permissions for interaction commands
41
- setRequiredPermissions: true
42
- # accept replied or deffered command interaction
43
- acceptRepliedInteractions: false
44
- # register commands to specific guild(s) empty to make it global
45
- guilds: []
46
+ # allow executing commands via aliases
47
+ allowCommandAlias: true
48
+ # command argument separator
49
+ commandArgumentSeparator: ' '
46
50
  # overwrite command permissions
47
51
  permissions:
48
52
  # enable overwriten command permissions
@@ -52,7 +56,6 @@ commands:
52
56
  permissions:
53
57
  - Administrator
54
58
 
55
-
56
59
  # Logger options
57
60
  fileLogging:
58
61
  # enable console output to file
@@ -93,7 +96,9 @@ messages:
93
96
  ephemeral: true
94
97
 
95
98
  # Ignored Files
96
- ignoredFiles: []
99
+ ignoredFiles:
100
+ - '_*'
101
+ - '.*'
97
102
 
98
103
 
99
104
  ####################################################
package/dist/cjs/bin.js DELETED
@@ -1,54 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const RecipleClient_1 = require("./reciple/classes/RecipleClient");
8
- const RecipleConfig_1 = require("./reciple/classes/RecipleConfig");
9
- const version_1 = require("./reciple/version");
10
- const fs_1 = require("fs");
11
- const flags_1 = require("./reciple/flags");
12
- const fallout_utility_1 = require("fallout-utility");
13
- const chalk_1 = __importDefault(require("chalk"));
14
- require("dotenv/config");
15
- const path_1 = __importDefault(require("path"));
16
- const allowedFiles = ['node_modules', 'reciple.yml', 'package.json'];
17
- const configPath = path_1.default.join(flags_1.cwd, './reciple.yml');
18
- if ((0, fs_1.readdirSync)(flags_1.cwd).filter(f => !f.startsWith('.') && allowedFiles.indexOf(f)).length > 0 && !(0, fs_1.existsSync)(flags_1.flags.config ?? configPath)) {
19
- const ask = (flags_1.flags.yes ? 'y' : null) ?? (0, fallout_utility_1.input)('This directory does not contain reciple.yml. Would you like to init axis here? [y/n] ') ?? '';
20
- if (ask.toString().toLowerCase() !== 'y')
21
- process.exit(0);
22
- }
23
- let configParser;
24
- try {
25
- configParser = new RecipleConfig_1.RecipleConfig(flags_1.flags.config ?? configPath).parseConfig();
26
- }
27
- catch (err) {
28
- console.error(`${chalk_1.default.bold.red('Config Error')}: ${chalk_1.default.white(err.message)}`);
29
- process.exit(1);
30
- }
31
- const config = configParser.getConfig();
32
- const client = new RecipleClient_1.RecipleClient({ config: config, ...config.client });
33
- if (!client.isClientLogsSilent)
34
- client.logger.info('Starting Reciple client v' + version_1.rawVersion);
35
- (async () => {
36
- client.addCommandListeners();
37
- await client.modules.startModules(await client.modules.getModulesFromFiles({
38
- files: await client.modules.getModuleFiles(),
39
- }));
40
- client.on('ready', async () => {
41
- await client.modules.loadModules(client.modules.modules.toJSON(), true);
42
- if (!client.isClientLogsSilent)
43
- client.logger.log(`Loaded ${client.commands.slashCommands.size} slash commands`, `Loaded ${client.commands.messageCommands.size} message commands`);
44
- if (client.config.commands.slashCommand.registerCommands)
45
- await client.commands.registerApplicationCommands();
46
- if (!client.isClientLogsSilent)
47
- client.logger.warn(`Logged in as ${client.user?.tag || 'Unknown'}!`);
48
- client.on('cacheSweep', () => client.cooldowns.clean());
49
- });
50
- client.login(config.token).catch(err => {
51
- if (!client.isClientLogsSilent)
52
- client.logger.error(err);
53
- });
54
- })();
@@ -1,37 +0,0 @@
1
- import { ApplicationCommandData, Collection, GuildResolvable, RestOrArray } from 'discord.js';
2
- import { AnyCommandBuilder, AnyCommandData, AnySlashCommandBuilder, CommandType, MessageCommandData, SlashCommandData } from '../../types/builders';
3
- import { MessageCommandBuilder } from '../builders/MessageCommandBuilder';
4
- import { SlashCommandBuilder } from '../builders/SlashCommandBuilder';
5
- import { RecipleClient } from '../RecipleClient';
6
- import { ApplicationCommandBuilder } from './ApplicationCommandManager';
7
- export interface ClientCommandManagerOptions {
8
- client: RecipleClient;
9
- messageCommands?: (MessageCommandBuilder | MessageCommandData)[];
10
- slashCommands?: (AnySlashCommandBuilder | SlashCommandData)[];
11
- }
12
- export declare class ClientCommandManager {
13
- readonly client: RecipleClient;
14
- readonly slashCommands: Collection<string, AnySlashCommandBuilder>;
15
- readonly messageCommands: Collection<string, MessageCommandBuilder>;
16
- readonly additionalApplicationCommands: (ApplicationCommandBuilder | ApplicationCommandData)[];
17
- get applicationCommandsSize(): number;
18
- constructor(options: ClientCommandManagerOptions);
19
- /**
20
- * Add command to command manager
21
- * @param commands Any command data or builder
22
- */
23
- add(...commands: RestOrArray<AnyCommandBuilder | AnyCommandData>): this;
24
- /**
25
- * Get command builder by name or alias if it's a message command
26
- * @param command Command name
27
- * @param type Command type
28
- */
29
- get(command: string, type?: undefined): AnyCommandBuilder | undefined;
30
- get(command: string, type?: CommandType.MessageCommand): MessageCommandBuilder | undefined;
31
- get(command: string, type?: CommandType.SlashCommand): SlashCommandBuilder | undefined;
32
- /**
33
- * Register application commands
34
- * @param guilds Register application commands to guilds
35
- */
36
- registerApplicationCommands(...guilds: RestOrArray<GuildResolvable>): Promise<this>;
37
- }
@@ -1,19 +0,0 @@
1
- import { Collection, RestOrArray } from 'discord.js';
2
- import { ClientModuleManagerGetModulesFromFilesOptions } from '../../types/paramOptions';
3
- import { RecipleClient } from '../RecipleClient';
4
- import { RecipleModule, RecipleScript } from '../RecipleModule';
5
- export interface ClientModuleManagerOptions {
6
- client: RecipleClient;
7
- modules?: (RecipleModule | RecipleScript)[];
8
- }
9
- export declare class ClientModuleManager {
10
- readonly client: RecipleClient;
11
- readonly modules: Collection<string, RecipleModule>;
12
- constructor(options: ClientModuleManagerOptions);
13
- startModules(modules: RecipleModule[], ignoreErrors?: boolean): Promise<RecipleModule[]>;
14
- loadModules(modules: RecipleModule[], addModuleCommandsToClient?: boolean, ignoreErrors?: boolean): Promise<RecipleModule[]>;
15
- unLoadModules(modules: RecipleModule[], removeUnloadedModules?: boolean, ignoreErrors?: boolean): Promise<RecipleModule[]>;
16
- getModulesFromFiles(options: ClientModuleManagerGetModulesFromFilesOptions): Promise<RecipleModule[]>;
17
- static validateScript(script: unknown): script is RecipleScript;
18
- getModuleFiles(...folders: RestOrArray<string>): Promise<string[]>;
19
- }