necord 5.3.0 → 5.3.1

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
+ # [5.3.0](https://github.com/necordjs/necord/compare/v5.2.0...v5.3.0) - (2022-09-17)
5
+
6
+ ## Features
7
+
8
+ - **modal:** Add dynamic matching (#385) ([96a0c8f](https://github.com/necordjs/necord/commit/96a0c8ff235655fff3838e0e5e78b12cdd50f3fa))
9
+
4
10
  # [5.2.0](https://github.com/necordjs/necord/compare/v5.1.0...v5.2.0) - (2022-08-11)
5
11
 
6
12
  ## Features
@@ -1,6 +1,6 @@
1
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 type ContextMenuMeta = (MessageApplicationCommandData | UserApplicationCommandData) & {
4
4
  guilds?: Snowflake[];
5
5
  };
6
6
  export declare class ContextMenuDiscovery extends CommandDiscovery<ContextMenuMeta> {
@@ -1 +1,7 @@
1
+ /**
2
+ * @deprecated Use `@TargetMessage`, `@TargetUser` or `@TargetMember` instead
3
+ */
1
4
  export declare const Target: (...dataOrPipes: any[]) => ParameterDecorator;
5
+ export declare const TargetMessage: (...dataOrPipes: any[]) => ParameterDecorator;
6
+ export declare const TargetUser: (...dataOrPipes: any[]) => ParameterDecorator;
7
+ export declare const TargetMember: (...dataOrPipes: any[]) => ParameterDecorator;
@@ -1,8 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Target = void 0;
3
+ exports.TargetMember = exports.TargetUser = exports.TargetMessage = exports.Target = void 0;
4
4
  const common_1 = require("@nestjs/common");
5
5
  const context_1 = require("../../../context");
6
+ /**
7
+ * @deprecated Use `@TargetMessage`, `@TargetUser` or `@TargetMember` instead
8
+ */
6
9
  exports.Target = (0, common_1.createParamDecorator)((_, context) => {
7
10
  const necordContext = context_1.NecordExecutionContext.create(context);
8
11
  const [interaction] = necordContext.getContext();
@@ -12,3 +15,24 @@ exports.Target = (0, common_1.createParamDecorator)((_, context) => {
12
15
  ? interaction.options.getMessage('message')
13
16
  : interaction.options.getUser('user');
14
17
  });
18
+ exports.TargetMessage = (0, common_1.createParamDecorator)((_, context) => {
19
+ const necordContext = context_1.NecordExecutionContext.create(context);
20
+ const [interaction] = necordContext.getContext();
21
+ if (!interaction.isMessageContextMenuCommand())
22
+ return null;
23
+ return interaction.targetMessage;
24
+ });
25
+ exports.TargetUser = (0, common_1.createParamDecorator)((_, context) => {
26
+ const necordContext = context_1.NecordExecutionContext.create(context);
27
+ const [interaction] = necordContext.getContext();
28
+ if (!interaction.isUserContextMenuCommand())
29
+ return null;
30
+ return interaction.targetUser;
31
+ });
32
+ exports.TargetMember = (0, common_1.createParamDecorator)((_, context) => {
33
+ const necordContext = context_1.NecordExecutionContext.create(context);
34
+ const [interaction] = necordContext.getContext();
35
+ if (!interaction.isUserContextMenuCommand())
36
+ return null;
37
+ return interaction.targetMember;
38
+ });
@@ -1,11 +1,11 @@
1
1
  import { AutocompleteInteraction, ButtonInteraction, ChatInputCommandInteraction, Message, MessageContextMenuCommandInteraction, ModalSubmitInteraction, SelectMenuInteraction, UserContextMenuCommandInteraction } from 'discord.js';
2
2
  import { NecordEvents } from '../listeners/listener.interface';
3
- export declare type AutocompleteContext = [AutocompleteInteraction];
4
- export declare type SlashCommandContext = [ChatInputCommandInteraction];
5
- export declare type TextCommandContext = [Message];
6
- export declare type MessageCommandContext = [MessageContextMenuCommandInteraction];
7
- export declare type UserCommandContext = [UserContextMenuCommandInteraction];
8
- export declare type ModalContext = [ModalSubmitInteraction];
9
- export declare type ButtonContext = [ButtonInteraction];
10
- export declare type SelectMenuContext = [SelectMenuInteraction];
11
- export declare type ContextOf<K extends keyof E, E = NecordEvents> = E[K];
3
+ export type AutocompleteContext = [AutocompleteInteraction];
4
+ export type SlashCommandContext = [ChatInputCommandInteraction];
5
+ export type TextCommandContext = [Message];
6
+ export type MessageCommandContext = [MessageContextMenuCommandInteraction];
7
+ export type UserCommandContext = [UserContextMenuCommandInteraction];
8
+ export type ModalContext = [ModalSubmitInteraction];
9
+ export type ButtonContext = [ButtonInteraction];
10
+ export type SelectMenuContext = [SelectMenuInteraction];
11
+ export type ContextOf<K extends keyof E, E = NecordEvents> = E[K];
@@ -1,6 +1,6 @@
1
1
  import { ContextType, ExecutionContext } from '@nestjs/common';
2
2
  import { NecordArgumentsHost } from './necord-arguments-host';
3
- export declare type NecordContextType = 'necord' | ContextType;
3
+ export type NecordContextType = 'necord' | ContextType;
4
4
  export declare class NecordExecutionContext extends NecordArgumentsHost {
5
5
  static create(context: ExecutionContext): NecordExecutionContext;
6
6
  }
@@ -35,10 +35,6 @@ const necord_explorer_service_1 = require("./necord-explorer.service");
35
35
  const commands_1 = require("./commands");
36
36
  const core_1 = require("@nestjs/core");
37
37
  let NecordModule = NecordModule_1 = class NecordModule {
38
- constructor(client, options) {
39
- this.client = client;
40
- this.options = options;
41
- }
42
38
  static forRoot(options) {
43
39
  return {
44
40
  module: NecordModule_1,
@@ -85,6 +81,10 @@ let NecordModule = NecordModule_1 = class NecordModule {
85
81
  inject: [options.useExisting || options.useClass]
86
82
  };
87
83
  }
84
+ constructor(client, options) {
85
+ this.client = client;
86
+ this.options = options;
87
+ }
88
88
  onApplicationBootstrap() {
89
89
  return this.client.login(this.options.token);
90
90
  }
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.3.0",
4
+ "version": "5.3.1",
5
5
  "scripts": {
6
6
  "build": "rimraf -rf dist && tsc -p tsconfig.json",
7
7
  "prepublish:npm": "npm run build",
@@ -51,29 +51,29 @@
51
51
  "path-to-regexp": "6.2.1"
52
52
  },
53
53
  "devDependencies": {
54
- "@commitlint/cli": "17.1.2",
55
- "@commitlint/config-angular": "17.1.0",
54
+ "@commitlint/cli": "17.3.0",
55
+ "@commitlint/config-angular": "17.3.0",
56
56
  "@favware/npm-deprecate": "1.0.5",
57
- "@nestjs/common": "8.4.7",
58
- "@nestjs/core": "8.4.7",
59
- "@types/node": "18.7.18",
60
- "@typescript-eslint/eslint-plugin": "5.37.0",
61
- "@typescript-eslint/parser": "5.37.0",
62
- "discord-api-types": "0.37.10",
63
- "discord.js": "14.3.0",
64
- "eslint": "8.23.1",
57
+ "@nestjs/common": "9.2.0",
58
+ "@nestjs/core": "9.2.0",
59
+ "@types/node": "18.11.9",
60
+ "@typescript-eslint/eslint-plugin": "5.44.0",
61
+ "@typescript-eslint/parser": "5.44.0",
62
+ "discord-api-types": "0.37.20",
63
+ "discord.js": "14.6.0",
64
+ "eslint": "8.28.0",
65
65
  "eslint-config-prettier": "8.5.0",
66
66
  "eslint-plugin-prettier": "4.2.1",
67
- "husky": "8.0.1",
68
- "jest": "29.0.3",
69
- "lint-staged": "13.0.3",
70
- "prettier": "2.7.1",
67
+ "husky": "8.0.2",
68
+ "jest": "29.3.1",
69
+ "lint-staged": "13.0.4",
70
+ "prettier": "2.8.0",
71
71
  "reflect-metadata": "0.1.13",
72
- "release-it": "15.4.2",
72
+ "release-it": "15.5.0",
73
73
  "rimraf": "3.0.2",
74
- "rxjs": "7.5.6",
74
+ "rxjs": "7.5.7",
75
75
  "ts-node": "10.9.1",
76
- "typescript": "4.8.3"
76
+ "typescript": "4.9.3"
77
77
  },
78
78
  "peerDependencies": {
79
79
  "@nestjs/common": "^8.0.0 || ^9.0.0",