reciple 5.4.1 → 5.4.4

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.
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.registerApplicationCommands = void 0;
13
4
  const discord_js_1 = require("discord.js");
@@ -16,49 +7,45 @@ const SlashCommandBuilder_1 = require("./classes/builders/SlashCommandBuilder");
16
7
  * Register application commands
17
8
  * @param options Register application commands options
18
9
  */
19
- function registerApplicationCommands(options) {
20
- var _a, _b, _c, _d;
21
- return __awaiter(this, void 0, void 0, function* () {
22
- const client = options.client;
23
- const guilds = (0, discord_js_1.normalizeArray)(options.guilds);
24
- const commands = (_b = Object.values((_a = options.commands) !== null && _a !== void 0 ? _a : client.commands.slashCommands).map(cmd => {
25
- var _a;
26
- if (typeof (cmd === null || cmd === void 0 ? void 0 : cmd.toJSON) == 'undefined')
27
- return cmd;
28
- cmd = cmd;
29
- if (SlashCommandBuilder_1.SlashCommandBuilder.isSlashCommandBuilder(cmd) && client.config.commands.slashCommand.setRequiredPermissions) {
30
- const permissions = client.config.commands.slashCommand.permissions.enabled
31
- ? (_a = client.config.commands.slashCommand.permissions.commands.find(cmd_ => cmd_.command.toLowerCase() === cmd.name.toLowerCase())) === null || _a === void 0 ? void 0 : _a.permissions
32
- : undefined;
33
- if (permissions) {
34
- cmd.setRequiredMemberPermissions(...permissions);
35
- if (client.isClientLogsEnabled())
36
- client.logger.debug(`Set required permissions for ${cmd.name}`);
37
- }
38
- client.commands.slashCommands[cmd.name] = cmd;
39
- }
40
- return cmd.toJSON();
41
- })) !== null && _b !== void 0 ? _b : [];
42
- if (!client.isReady())
43
- throw new Error('Client is not ready');
44
- if (!guilds || !(guilds === null || guilds === void 0 ? void 0 : guilds.length)) {
45
- (_c = client.application) === null || _c === void 0 ? void 0 : _c.commands.set(commands).then(() => {
10
+ async function registerApplicationCommands(options) {
11
+ const client = options.client;
12
+ const guilds = (0, discord_js_1.normalizeArray)(options.guilds);
13
+ const commands = Object.values(options.commands ?? client.commands.slashCommands).map(cmd => {
14
+ if (typeof cmd?.toJSON == 'undefined')
15
+ return cmd;
16
+ cmd = cmd;
17
+ if (SlashCommandBuilder_1.SlashCommandBuilder.isSlashCommandBuilder(cmd) && client.config.commands.slashCommand.setRequiredPermissions) {
18
+ const permissions = client.config.commands.slashCommand.permissions.enabled
19
+ ? client.config.commands.slashCommand.permissions.commands.find(cmd_ => cmd_.command.toLowerCase() === cmd.name.toLowerCase())?.permissions
20
+ : undefined;
21
+ if (permissions) {
22
+ cmd.setRequiredMemberPermissions(...permissions);
46
23
  if (client.isClientLogsEnabled())
47
- client.logger.warn('No guilds were specified for application commands. Registered application commands globally.');
48
- });
24
+ client.logger.debug(`Set required permissions for ${cmd.name}`);
25
+ }
26
+ client.commands.slashCommands[cmd.name] = cmd;
49
27
  }
50
- else {
28
+ return cmd.toJSON();
29
+ }) ?? [];
30
+ if (!client.isReady())
31
+ throw new Error('Client is not ready');
32
+ if (!guilds || !guilds?.length) {
33
+ client.application?.commands.set(commands).then(() => {
51
34
  if (client.isClientLogsEnabled())
52
- client.logger.warn(`Registering ${commands.length} application commands to ${guilds.length} guild(s).`);
53
- for (const guild of guilds) {
54
- if (!guild)
55
- continue;
56
- (_d = client.application) === null || _d === void 0 ? void 0 : _d.commands.set(commands, guild).then(() => {
57
- if (client.isClientLogsEnabled())
58
- client.logger.warn(`Registered ${commands.length} application command(s) for ${guild}.`);
59
- });
60
- }
35
+ client.logger.warn('No guilds were specified for application commands. Registered application commands globally.');
36
+ });
37
+ }
38
+ else {
39
+ if (client.isClientLogsEnabled())
40
+ client.logger.warn(`Registering ${commands.length} application commands to ${guilds.length} guild(s).`);
41
+ for (const guild of guilds) {
42
+ if (!guild)
43
+ continue;
44
+ client.application?.commands.set(commands, guild).then(() => {
45
+ if (client.isClientLogsEnabled())
46
+ client.logger.warn(`Registered ${commands.length} application command(s) for ${guild}.`);
47
+ });
61
48
  }
62
- });
49
+ }
63
50
  }
64
51
  exports.registerApplicationCommands = registerApplicationCommands;
@@ -108,7 +108,7 @@ export interface SlashCommandData extends SharedCommandDataProperties, Partial<O
108
108
  type: CommandBuilderType.SlashCommand;
109
109
  nameLocalizations?: LocalizationMap;
110
110
  descriptionLocalizations?: LocalizationMap;
111
- options: (AnySlashCommandOptionData | AnySlashCommandOptionBuilder)[];
111
+ options?: (AnySlashCommandOptionData | AnySlashCommandOptionBuilder)[];
112
112
  /**
113
113
  * @deprecated This property is deprecated and will be removed in the future.
114
114
  */
@@ -186,8 +186,6 @@ export interface MessageCommandData extends SharedCommandDataProperties, Partial
186
186
  * Message command option object data interface
187
187
  */
188
188
  export interface MessageCommandOptionData extends SharedCommandDataProperties {
189
- name: string;
190
- description: string;
191
- required: boolean;
192
- validator: (value: string) => Awaitable<boolean>;
189
+ required?: boolean;
190
+ validator?: (value: string) => Awaitable<boolean>;
193
191
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reciple",
3
- "version": "5.4.1",
3
+ "version": "5.4.4",
4
4
  "bin": "bin/bin.js",
5
5
  "license": "GPL-3.0",
6
6
  "main": "bin/index.js",
@@ -14,7 +14,7 @@
14
14
  "Reciple"
15
15
  ],
16
16
  "contributors": [
17
- "GhexterCortes <cortesghexter@gmail.com>"
17
+ "GhexterCortes"
18
18
  ],
19
19
  "bugs": {
20
20
  "url": "https://github.com/FalloutStudios/reciple/issues"
@@ -37,6 +37,7 @@
37
37
  "type": "git",
38
38
  "url": "git+https://github.com/FalloutStudios/reciple.git"
39
39
  },
40
+ "engineStrict": true,
40
41
  "engines": {
41
42
  "node": ">=16.9.0"
42
43
  },
@@ -50,18 +51,18 @@
50
51
  "dependencies": {
51
52
  "chalk": "4.1.2",
52
53
  "commander": "^9.4.0",
53
- "dotenv": "^16.0.1",
54
+ "dotenv": "^16.0.2",
54
55
  "fallout-utility": "^1.4.6",
55
56
  "semver": "^7.3.7",
56
57
  "wildcard-match": "^5.1.2",
57
58
  "yaml": "^2.1.1"
58
59
  },
59
60
  "devDependencies": {
60
- "@types/node": "^18.7.13",
61
+ "@types/node": "^18.7.14",
61
62
  "@types/semver": "^7.3.12",
62
63
  "discord.js": "^14.3.0",
63
64
  "rimraf": "^3.0.2",
64
- "typedoc": "^0.23.11",
65
+ "typedoc": "^0.23.14",
65
66
  "typedoc-plugin-discord-types": "^1.0.2",
66
67
  "typedoc-plugin-djs-links": "^1.2.0",
67
68
  "typedoc-plugin-mdn-links": "^2.0.0",