@globalart/nestcord 1.5.5 → 1.5.6

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.
@@ -24,6 +24,7 @@ export declare class CommandsService {
24
24
  getCommands(): CommandDiscovery[];
25
25
  getCommandsByGuilds(): Collection<string, CommandDiscovery[]>;
26
26
  getCommandsByCategoryMap(): Map<string, CommandDiscovery[]>;
27
+ getCommandsMap(): Map<string, CommandDiscovery>;
27
28
  getCommandByName(name: string): CommandDiscovery;
28
29
  getGlobalCommands(): CommandDiscovery[];
29
30
  getGlobalCommandByName(name: string): CommandDiscovery;
@@ -80,7 +80,20 @@ let CommandsService = CommandsService_1 = class CommandsService {
80
80
  return collection;
81
81
  }
82
82
  getCommandsByCategoryMap() {
83
- return this.getCommands().reduce((map, command) => map.set(command.meta.category || 'no_group', (map.get(command.meta.category || 'no_group') || []).concat(command)), new Map());
83
+ return this.getCommands().reduce((map, command) => {
84
+ const category = command.meta.category || 'no_group';
85
+ if (!map.has(category)) {
86
+ map.set(category, []);
87
+ }
88
+ map.get(category).push(command);
89
+ return map;
90
+ }, new Map());
91
+ }
92
+ getCommandsMap() {
93
+ return this.getCommands().reduce((map, command) => {
94
+ map.set(command.getName(), command);
95
+ return map;
96
+ }, new Map());
84
97
  }
85
98
  getCommandByName(name) {
86
99
  return this.getCommands().find((command) => command.getName() === name);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@globalart/nestcord",
3
3
  "description": "A module for creating Discord bots using NestJS, based on Discord.js",
4
- "version": "1.5.5",
4
+ "version": "1.5.6",
5
5
  "private": false,
6
6
  "scripts": {
7
7
  "build": "rimraf dist && tsc -p tsconfig.build.json",