reciple 6.0.0-dev.9 → 6.0.0

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 (90) hide show
  1. package/README.md +1 -2
  2. package/dist/lib/bin.mjs +70 -0
  3. package/dist/lib/bin.mjs.map +1 -0
  4. package/dist/lib/esm.mjs +2 -0
  5. package/dist/lib/esm.mjs.map +1 -0
  6. package/dist/{cjs → lib}/index.js +17 -17
  7. package/dist/lib/index.js.map +1 -0
  8. package/dist/{cjs → lib}/reciple/classes/RecipleClient.js +33 -24
  9. package/dist/lib/reciple/classes/RecipleClient.js.map +1 -0
  10. package/dist/{cjs → lib}/reciple/classes/RecipleConfig.js +11 -10
  11. package/dist/lib/reciple/classes/RecipleConfig.js.map +1 -0
  12. package/dist/{cjs → lib}/reciple/classes/RecipleModule.js +58 -15
  13. package/dist/lib/reciple/classes/RecipleModule.js.map +1 -0
  14. package/dist/{cjs → lib}/reciple/classes/builders/MessageCommandBuilder.js +150 -82
  15. package/dist/lib/reciple/classes/builders/MessageCommandBuilder.js.map +1 -0
  16. package/dist/{cjs → lib}/reciple/classes/builders/MessageCommandOptionBuilder.js +55 -13
  17. package/dist/lib/reciple/classes/builders/MessageCommandOptionBuilder.js.map +1 -0
  18. package/dist/{cjs → lib}/reciple/classes/builders/SlashCommandBuilder.js +41 -10
  19. package/dist/lib/reciple/classes/builders/SlashCommandBuilder.js.map +1 -0
  20. package/dist/{cjs → lib}/reciple/classes/managers/ApplicationCommandManager.js +49 -6
  21. package/dist/lib/reciple/classes/managers/ApplicationCommandManager.js.map +1 -0
  22. package/dist/{cjs → lib}/reciple/classes/managers/CommandCooldownManager.js +1 -1
  23. package/dist/lib/reciple/classes/managers/CommandCooldownManager.js.map +1 -0
  24. package/dist/{cjs/reciple/classes/managers/ClientCommandManager.js → lib/reciple/classes/managers/CommandManager.js} +16 -13
  25. package/dist/lib/reciple/classes/managers/CommandManager.js.map +1 -0
  26. package/dist/{cjs → lib}/reciple/classes/managers/MessageCommandOptionManager.js +1 -0
  27. package/dist/lib/reciple/classes/managers/MessageCommandOptionManager.js.map +1 -0
  28. package/dist/{cjs/reciple/classes/managers/ClientModuleManager.js → lib/reciple/classes/managers/ModuleManager.js} +78 -64
  29. package/dist/lib/reciple/classes/managers/ModuleManager.js.map +1 -0
  30. package/dist/{cjs → lib}/reciple/flags.js +4 -3
  31. package/dist/lib/reciple/flags.js.map +1 -0
  32. package/dist/{cjs → lib}/reciple/permissions.js +1 -0
  33. package/dist/lib/reciple/permissions.js.map +1 -0
  34. package/dist/{cjs → lib}/reciple/types/builders.js +2 -1
  35. package/dist/lib/reciple/types/builders.js.map +1 -0
  36. package/dist/{cjs → lib}/reciple/types/commands.js +7 -6
  37. package/dist/lib/reciple/types/commands.js.map +1 -0
  38. package/dist/{cjs → lib}/reciple/types/paramOptions.js +1 -0
  39. package/dist/lib/reciple/types/paramOptions.js.map +1 -0
  40. package/dist/{cjs → lib}/reciple/util.js +13 -7
  41. package/dist/lib/reciple/util.js.map +1 -0
  42. package/dist/{cjs → lib}/reciple/version.js +1 -1
  43. package/dist/lib/reciple/version.js.map +1 -0
  44. package/dist/types/{bin.d.ts → bin.d.mts} +1 -0
  45. package/dist/types/bin.d.mts.map +1 -0
  46. package/dist/types/esm.d.mts +2 -0
  47. package/dist/types/esm.d.mts.map +1 -0
  48. package/dist/types/index.d.ts +17 -17
  49. package/dist/types/index.d.ts.map +1 -0
  50. package/dist/types/reciple/classes/RecipleClient.d.ts +22 -8
  51. package/dist/types/reciple/classes/RecipleClient.d.ts.map +1 -0
  52. package/dist/types/reciple/classes/RecipleConfig.d.ts +4 -2
  53. package/dist/types/reciple/classes/RecipleConfig.d.ts.map +1 -0
  54. package/dist/types/reciple/classes/RecipleModule.d.ts +37 -5
  55. package/dist/types/reciple/classes/RecipleModule.d.ts.map +1 -0
  56. package/dist/types/reciple/classes/builders/MessageCommandBuilder.d.ts +66 -26
  57. package/dist/types/reciple/classes/builders/MessageCommandBuilder.d.ts.map +1 -0
  58. package/dist/types/reciple/classes/builders/MessageCommandOptionBuilder.d.ts +18 -7
  59. package/dist/types/reciple/classes/builders/MessageCommandOptionBuilder.d.ts.map +1 -0
  60. package/dist/types/reciple/classes/builders/SlashCommandBuilder.d.ts +21 -10
  61. package/dist/types/reciple/classes/builders/SlashCommandBuilder.d.ts.map +1 -0
  62. package/dist/types/reciple/classes/managers/ApplicationCommandManager.d.ts +45 -6
  63. package/dist/types/reciple/classes/managers/ApplicationCommandManager.d.ts.map +1 -0
  64. package/dist/types/reciple/classes/managers/CommandCooldownManager.d.ts +1 -0
  65. package/dist/types/reciple/classes/managers/CommandCooldownManager.d.ts.map +1 -0
  66. package/dist/types/reciple/classes/managers/CommandManager.d.ts +35 -0
  67. package/dist/types/reciple/classes/managers/CommandManager.d.ts.map +1 -0
  68. package/dist/types/reciple/classes/managers/MessageCommandOptionManager.d.ts +2 -1
  69. package/dist/types/reciple/classes/managers/MessageCommandOptionManager.d.ts.map +1 -0
  70. package/dist/types/reciple/classes/managers/ModuleManager.d.ts +50 -0
  71. package/dist/types/reciple/classes/managers/ModuleManager.d.ts.map +1 -0
  72. package/dist/types/reciple/flags.d.ts +2 -1
  73. package/dist/types/reciple/flags.d.ts.map +1 -0
  74. package/dist/types/reciple/permissions.d.ts +3 -6
  75. package/dist/types/reciple/permissions.d.ts.map +1 -0
  76. package/dist/types/reciple/types/builders.d.ts +25 -16
  77. package/dist/types/reciple/types/builders.d.ts.map +1 -0
  78. package/dist/types/reciple/types/commands.d.ts +16 -15
  79. package/dist/types/reciple/types/commands.d.ts.map +1 -0
  80. package/dist/types/reciple/types/paramOptions.d.ts +80 -3
  81. package/dist/types/reciple/types/paramOptions.d.ts.map +1 -0
  82. package/dist/types/reciple/util.d.ts +9 -2
  83. package/dist/types/reciple/util.d.ts.map +1 -0
  84. package/dist/types/reciple/version.d.ts +1 -0
  85. package/dist/types/reciple/version.d.ts.map +1 -0
  86. package/package.json +44 -35
  87. package/resource/reciple.yml +25 -22
  88. package/dist/cjs/bin.js +0 -54
  89. package/dist/types/reciple/classes/managers/ClientCommandManager.d.ts +0 -37
  90. 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.0",
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.17",
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,24 @@ 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
+ # register commands to specific guild(s) empty to make it global
24
+ guilds: []
21
25
  # overwrite command permissions
22
26
  permissions:
23
27
  # enable overwriten command permissions
@@ -27,22 +31,20 @@ commands:
27
31
  permissions:
28
32
  - Administrator
29
33
 
30
- # Interaction command options
31
- slashCommand:
32
- # enable interaction commands
34
+ # message command options
35
+ messageCommand:
36
+ # enable message commands
33
37
  enabled: true
38
+ # command prefix
39
+ prefix: '!'
34
40
  # reply when an error occured
35
41
  replyOnError: false
36
42
  # enable the use of command cooldowns
37
43
  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: []
44
+ # allow executing commands via aliases
45
+ allowCommandAlias: true
46
+ # command argument separator
47
+ commandArgumentSeparator: ' '
46
48
  # overwrite command permissions
47
49
  permissions:
48
50
  # enable overwriten command permissions
@@ -52,7 +54,6 @@ commands:
52
54
  permissions:
53
55
  - Administrator
54
56
 
55
-
56
57
  # Logger options
57
58
  fileLogging:
58
59
  # enable console output to file
@@ -93,7 +94,9 @@ messages:
93
94
  ephemeral: true
94
95
 
95
96
  # Ignored Files
96
- ignoredFiles: []
97
+ ignoredFiles:
98
+ - '_*'
99
+ - '.*'
97
100
 
98
101
 
99
102
  ####################################################
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
- }