necord 5.1.0 → 5.2.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.
- package/CHANGELOG.md +10 -0
- package/dist/commands/command.discovery.d.ts +5 -2
- package/dist/commands/command.discovery.js +3 -1
- package/dist/commands/commands.service.js +6 -6
- package/dist/commands/context-menus/context-menu.discovery.d.ts +4 -2
- package/dist/commands/slash-commands/slash-command.discovery.d.ts +2 -1
- package/package.json +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
|
3
3
|
|
|
4
|
+
# [5.1.0](https://github.com/necordjs/necord/compare/v5.0.3...v5.1.0) - (2022-07-31)
|
|
5
|
+
|
|
6
|
+
## Bug Fixes
|
|
7
|
+
|
|
8
|
+
- Usage without data parameter for `ComponentParam` ([8c7ce11](https://github.com/necordjs/necord/commit/8c7ce11d620134d4f8e8e4dac9cb56984d1e0917))
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- Support dynamic matching for components ([1b470b3](https://github.com/necordjs/necord/commit/1b470b3ee80db37d285ee010153431e2a5847627))
|
|
13
|
+
|
|
4
14
|
# [5.0.1](https://github.com/necordjs/necord/compare/v4.3.3...v5.0.1) - (2022-07-17)
|
|
5
15
|
|
|
6
16
|
## Bug Fixes
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { BaseApplicationCommandData } from 'discord.js';
|
|
1
|
+
import { BaseApplicationCommandData, Snowflake } from 'discord.js';
|
|
2
2
|
import { NecordBaseDiscovery } from '../context';
|
|
3
|
-
export declare abstract class CommandDiscovery<T extends BaseApplicationCommandData
|
|
3
|
+
export declare abstract class CommandDiscovery<T extends BaseApplicationCommandData & {
|
|
4
|
+
guilds?: Snowflake[];
|
|
5
|
+
} = BaseApplicationCommandData> extends NecordBaseDiscovery<T> {
|
|
4
6
|
getName(): string;
|
|
7
|
+
getGuilds(): Snowflake[];
|
|
5
8
|
}
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CommandDiscovery = void 0;
|
|
4
4
|
const context_1 = require("../context");
|
|
5
|
-
// TODO: Add guild parameter
|
|
6
5
|
class CommandDiscovery extends context_1.NecordBaseDiscovery {
|
|
7
6
|
getName() {
|
|
8
7
|
return this.meta.name;
|
|
9
8
|
}
|
|
9
|
+
getGuilds() {
|
|
10
|
+
return this.meta.guilds;
|
|
11
|
+
}
|
|
10
12
|
}
|
|
11
13
|
exports.CommandDiscovery = CommandDiscovery;
|
|
@@ -38,7 +38,7 @@ let CommandsService = CommandsService_1 = class CommandsService {
|
|
|
38
38
|
}
|
|
39
39
|
onModuleInit() {
|
|
40
40
|
return this.client.once('ready', (client) => __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
var _a;
|
|
41
|
+
var _a, _b;
|
|
42
42
|
if (client.application.partial) {
|
|
43
43
|
yield client.application.fetch();
|
|
44
44
|
}
|
|
@@ -49,12 +49,12 @@ let CommandsService = CommandsService_1 = class CommandsService {
|
|
|
49
49
|
];
|
|
50
50
|
const commandsByGuildMap = new Map([[undefined, []]]);
|
|
51
51
|
for (const command of commands) {
|
|
52
|
-
const
|
|
52
|
+
const guilds = Array.isArray(this.options.development)
|
|
53
53
|
? this.options.development
|
|
54
|
-
: [undefined];
|
|
55
|
-
for (const
|
|
56
|
-
const visitedCommands = (
|
|
57
|
-
commandsByGuildMap.set(
|
|
54
|
+
: (_a = command.getGuilds()) !== null && _a !== void 0 ? _a : [undefined];
|
|
55
|
+
for (const guildId of guilds) {
|
|
56
|
+
const visitedCommands = (_b = commandsByGuildMap.get(guildId)) !== null && _b !== void 0 ? _b : [];
|
|
57
|
+
commandsByGuildMap.set(guildId, visitedCommands.concat(command));
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
this.logger.log(`Started refreshing application commands.`);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { ContextMenuCommandInteraction, MessageApplicationCommandData, UserApplicationCommandData } from 'discord.js';
|
|
1
|
+
import { ContextMenuCommandInteraction, MessageApplicationCommandData, Snowflake, UserApplicationCommandData } from 'discord.js';
|
|
2
2
|
import { CommandDiscovery } from '../command.discovery';
|
|
3
|
-
export declare type ContextMenuMeta = MessageApplicationCommandData | UserApplicationCommandData
|
|
3
|
+
export declare type ContextMenuMeta = (MessageApplicationCommandData | UserApplicationCommandData) & {
|
|
4
|
+
guilds?: Snowflake[];
|
|
5
|
+
};
|
|
4
6
|
export declare class ContextMenuDiscovery extends CommandDiscovery<ContextMenuMeta> {
|
|
5
7
|
getType(): import("discord.js").ApplicationCommandType.User | import("discord.js").ApplicationCommandType.Message;
|
|
6
8
|
isContextMenu(): this is ContextMenuDiscovery;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ApplicationCommandOptionType, ApplicationCommandType, AutocompleteInteraction, ChatInputApplicationCommandData, ChatInputCommandInteraction, CommandInteractionOptionResolver } from 'discord.js';
|
|
1
|
+
import { ApplicationCommandOptionType, ApplicationCommandType, AutocompleteInteraction, ChatInputApplicationCommandData, ChatInputCommandInteraction, CommandInteractionOptionResolver, Snowflake } from 'discord.js';
|
|
2
2
|
import { APIApplicationCommandOptionBase } from 'discord-api-types/payloads/v10/_interactions/_applicationCommands/_chatInput/base';
|
|
3
3
|
import { CommandDiscovery } from '../command.discovery';
|
|
4
4
|
export interface SlashCommandMeta extends ChatInputApplicationCommandData {
|
|
5
5
|
type?: ApplicationCommandType.ChatInput | ApplicationCommandOptionType.SubcommandGroup | ApplicationCommandOptionType.Subcommand;
|
|
6
|
+
guilds?: Snowflake[];
|
|
6
7
|
}
|
|
7
8
|
export interface OptionMeta extends APIApplicationCommandOptionBase<any> {
|
|
8
9
|
resolver?: keyof CommandInteractionOptionResolver;
|
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": "5.
|
|
4
|
+
"version": "5.2.0",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "rimraf -rf dist && tsc -p tsconfig.json",
|
|
7
7
|
"prepublish:npm": "npm run build",
|
|
@@ -47,18 +47,21 @@
|
|
|
47
47
|
"contributors": [
|
|
48
48
|
"Alexey Filippov <socket.someone@gmail.com>"
|
|
49
49
|
],
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"path-to-regexp": "6.2.1"
|
|
52
|
+
},
|
|
50
53
|
"devDependencies": {
|
|
51
54
|
"@commitlint/cli": "17.0.3",
|
|
52
55
|
"@commitlint/config-angular": "17.0.3",
|
|
53
|
-
"@favware/npm-deprecate": "1.0.
|
|
56
|
+
"@favware/npm-deprecate": "1.0.5",
|
|
54
57
|
"@nestjs/common": "8.4.7",
|
|
55
58
|
"@nestjs/core": "8.4.7",
|
|
56
|
-
"@types/node": "18.6.
|
|
57
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
58
|
-
"@typescript-eslint/parser": "5.
|
|
59
|
-
"discord-api-types": "0.
|
|
60
|
-
"discord.js": "14.
|
|
61
|
-
"eslint": "8.
|
|
59
|
+
"@types/node": "18.6.5",
|
|
60
|
+
"@typescript-eslint/eslint-plugin": "5.33.0",
|
|
61
|
+
"@typescript-eslint/parser": "5.33.0",
|
|
62
|
+
"discord-api-types": "0.37.1",
|
|
63
|
+
"discord.js": "14.1.2",
|
|
64
|
+
"eslint": "8.21.0",
|
|
62
65
|
"eslint-config-prettier": "8.5.0",
|
|
63
66
|
"eslint-plugin-prettier": "4.2.1",
|
|
64
67
|
"husky": "8.0.1",
|
|
@@ -66,7 +69,7 @@
|
|
|
66
69
|
"lint-staged": "13.0.3",
|
|
67
70
|
"prettier": "2.7.1",
|
|
68
71
|
"reflect-metadata": "0.1.13",
|
|
69
|
-
"release-it": "15.
|
|
72
|
+
"release-it": "15.3.0",
|
|
70
73
|
"rimraf": "3.0.2",
|
|
71
74
|
"rxjs": "7.5.6",
|
|
72
75
|
"ts-node": "10.9.1",
|
|
@@ -82,8 +85,5 @@
|
|
|
82
85
|
"engines": {
|
|
83
86
|
"node": ">=16.6.0",
|
|
84
87
|
"npm": ">=7.0.0"
|
|
85
|
-
},
|
|
86
|
-
"dependencies": {
|
|
87
|
-
"path-to-regexp": "^6.2.1"
|
|
88
88
|
}
|
|
89
89
|
}
|