necord 6.1.2 → 6.1.3-dev.1693830158.8348d6e

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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ # [6.1.2](https://github.com/necordjs/necord/compare/v6.1.1...v6.1.2) - (2023-08-29)
5
+
6
+ ## Refactor
7
+
8
+ - Update types for nest version ([d9d1578](https://github.com/necordjs/necord/commit/d9d15780f1cb8745b7f3215bfb2b31115da29f76))
9
+
4
10
  # [6.1.0](https://github.com/necordjs/necord/compare/v6.0.0...v6.1.0) - (2023-08-21)
5
11
 
6
12
  ## Refactor
@@ -12,6 +12,7 @@ export declare class SlashCommandDiscovery extends CommandDiscovery<SlashCommand
12
12
  private readonly subcommands;
13
13
  getDescription(): string;
14
14
  setSubcommand(command: SlashCommandDiscovery): void;
15
+ ensureSubcommand(command: SlashCommandDiscovery): SlashCommandDiscovery;
15
16
  getRawOptions(): Record<string, OptionMeta>;
16
17
  getOptions(): any;
17
18
  execute(interaction: ChatInputCommandInteraction | AutocompleteInteraction, depth?: number): any;
@@ -15,6 +15,9 @@ class SlashCommandDiscovery extends command_discovery_1.CommandDiscovery {
15
15
  setSubcommand(command) {
16
16
  this.subcommands.set(command.getName(), command);
17
17
  }
18
+ ensureSubcommand(command) {
19
+ return this.subcommands.ensure(command.getName(), () => command);
20
+ }
18
21
  getRawOptions() {
19
22
  var _a;
20
23
  return (_a = this.reflector.get(options_1.OPTIONS_METADATA, this.getHandler())) !== null && _a !== void 0 ? _a : {};
@@ -51,20 +51,15 @@ let SlashCommandsService = SlashCommandsService_1 = class SlashCommandsService {
51
51
  return this.cache.delete(commandName);
52
52
  }
53
53
  addSubCommand(subCommand) {
54
- const rootCommand = this.reflector.get(decorators_1.SlashCommand.KEY, subCommand.getClass());
55
- const subCommandGroup = this.reflector.get(decorators_1.SubcommandGroup.KEY, subCommand.getClass());
56
- if (!rootCommand) {
57
- throw new ReferenceError(`can't register subcommand "${subCommand.getName()}" w/o root command`);
58
- }
54
+ let rootCommand = this.reflector.get(decorators_1.SlashCommand.KEY, subCommand.getClass());
55
+ let subCommandGroup = this.reflector.get(decorators_1.SubcommandGroup.KEY, subCommand.getClass());
56
+ rootCommand = this.cache.ensure(rootCommand.getName(), () => rootCommand);
59
57
  if (subCommandGroup) {
60
- subCommandGroup.setSubcommand(subCommand);
61
- rootCommand.setSubcommand(subCommandGroup);
58
+ subCommandGroup = rootCommand.ensureSubcommand(subCommandGroup);
59
+ subCommandGroup.ensureSubcommand(subCommand);
62
60
  }
63
61
  else {
64
- rootCommand.setSubcommand(subCommand);
65
- }
66
- if (!this.cache.has(rootCommand.getName())) {
67
- this.cache.set(rootCommand.getName(), rootCommand);
62
+ rootCommand.ensureSubcommand(subCommand);
68
63
  }
69
64
  }
70
65
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "necord",
3
3
  "description": "A module for creating Discord bots using NestJS, based on Discord.js",
4
- "version": "6.1.2",
4
+ "version": "6.1.3-dev.1693830158.8348d6e",
5
5
  "scripts": {
6
6
  "build": "rimraf dist && tsc -p tsconfig.build.json",
7
7
  "prepublish:npm": "npm run build",
@@ -58,19 +58,19 @@
58
58
  "@commitlint/cli": "17.7.1",
59
59
  "@commitlint/config-angular": "17.7.0",
60
60
  "@favware/npm-deprecate": "1.0.7",
61
- "@nestjs/common": "10.2.2",
62
- "@nestjs/core": "10.2.2",
63
- "@types/node": "20.5.7",
61
+ "@nestjs/common": "10.2.4",
62
+ "@nestjs/core": "10.2.4",
63
+ "@types/node": "20.5.9",
64
64
  "@typescript-eslint/eslint-plugin": "6.5.0",
65
65
  "@typescript-eslint/parser": "6.5.0",
66
- "discord-api-types": "0.37.55",
66
+ "discord-api-types": "0.37.56",
67
67
  "discord.js": "14.13.0",
68
68
  "eslint": "8.48.0",
69
69
  "eslint-config-prettier": "9.0.0",
70
70
  "eslint-plugin-prettier": "5.0.0",
71
71
  "husky": "8.0.3",
72
72
  "lint-staged": "14.0.1",
73
- "prettier": "3.0.2",
73
+ "prettier": "3.0.3",
74
74
  "reflect-metadata": "0.1.13",
75
75
  "release-it": "16.1.5",
76
76
  "rimraf": "5.0.1",