necord 6.13.0 → 7.0.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.
Files changed (219) hide show
  1. package/dist/commands/command.discovery.d.ts +3 -3
  2. package/dist/commands/command.discovery.js +2 -6
  3. package/dist/commands/commands.module.d.ts +4 -4
  4. package/dist/commands/commands.module.js +23 -22
  5. package/dist/commands/commands.service.d.ts +8 -7
  6. package/dist/commands/commands.service.js +24 -18
  7. package/dist/commands/context-menus/context-menu.discovery.d.ts +3 -3
  8. package/dist/commands/context-menus/context-menu.discovery.js +2 -6
  9. package/dist/commands/context-menus/context-menus.module.d.ts +4 -4
  10. package/dist/commands/context-menus/context-menus.module.js +16 -19
  11. package/dist/commands/context-menus/context-menus.service.d.ts +2 -2
  12. package/dist/commands/context-menus/context-menus.service.js +8 -11
  13. package/dist/commands/context-menus/decorators/context-menu.decorator.d.ts +1 -1
  14. package/dist/commands/context-menus/decorators/context-menu.decorator.js +4 -7
  15. package/dist/commands/context-menus/decorators/index.d.ts +4 -4
  16. package/dist/commands/context-menus/decorators/index.js +4 -7
  17. package/dist/commands/context-menus/decorators/message-command.decorator.d.ts +2 -2
  18. package/dist/commands/context-menus/decorators/message-command.decorator.js +3 -7
  19. package/dist/commands/context-menus/decorators/target.decorator.js +8 -11
  20. package/dist/commands/context-menus/decorators/user-command.decorator.d.ts +2 -2
  21. package/dist/commands/context-menus/decorators/user-command.decorator.js +3 -7
  22. package/dist/commands/context-menus/index.d.ts +4 -4
  23. package/dist/commands/context-menus/index.js +4 -7
  24. package/dist/commands/index.d.ts +5 -5
  25. package/dist/commands/index.js +5 -8
  26. package/dist/commands/slash-commands/autocomplete/autocomplete.interceptor.d.ts +1 -1
  27. package/dist/commands/slash-commands/autocomplete/autocomplete.interceptor.js +9 -12
  28. package/dist/commands/slash-commands/autocomplete/index.d.ts +1 -1
  29. package/dist/commands/slash-commands/autocomplete/index.js +1 -4
  30. package/dist/commands/slash-commands/decorators/index.d.ts +3 -3
  31. package/dist/commands/slash-commands/decorators/index.js +3 -6
  32. package/dist/commands/slash-commands/decorators/slash-command.decorator.d.ts +2 -2
  33. package/dist/commands/slash-commands/decorators/slash-command.decorator.js +6 -9
  34. package/dist/commands/slash-commands/decorators/subcommand-group.decorator.d.ts +3 -3
  35. package/dist/commands/slash-commands/decorators/subcommand-group.decorator.js +13 -17
  36. package/dist/commands/slash-commands/decorators/subcommand.decorator.d.ts +2 -2
  37. package/dist/commands/slash-commands/decorators/subcommand.decorator.js +6 -9
  38. package/dist/commands/slash-commands/index.d.ts +6 -6
  39. package/dist/commands/slash-commands/index.js +6 -9
  40. package/dist/commands/slash-commands/options/attachment-option.decorator.js +3 -6
  41. package/dist/commands/slash-commands/options/boolean-option.decorator.js +3 -6
  42. package/dist/commands/slash-commands/options/channel-option.decorator.js +3 -6
  43. package/dist/commands/slash-commands/options/index.d.ts +12 -12
  44. package/dist/commands/slash-commands/options/index.js +12 -15
  45. package/dist/commands/slash-commands/options/integer-option.decorator.js +3 -6
  46. package/dist/commands/slash-commands/options/member-option.decorator.js +3 -6
  47. package/dist/commands/slash-commands/options/mentionable-option.decorator.js +3 -6
  48. package/dist/commands/slash-commands/options/number-option.decorator.js +3 -6
  49. package/dist/commands/slash-commands/options/option.util.d.ts +2 -2
  50. package/dist/commands/slash-commands/options/option.util.js +5 -10
  51. package/dist/commands/slash-commands/options/options.decorator.js +22 -14
  52. package/dist/commands/slash-commands/options/role-option.decorator.js +3 -6
  53. package/dist/commands/slash-commands/options/string-option.decorator.js +3 -6
  54. package/dist/commands/slash-commands/options/user-option.decorator.js +3 -6
  55. package/dist/commands/slash-commands/slash-command.discovery.d.ts +5 -34
  56. package/dist/commands/slash-commands/slash-command.discovery.js +7 -10
  57. package/dist/commands/slash-commands/slash-commands.module.d.ts +4 -4
  58. package/dist/commands/slash-commands/slash-commands.module.js +17 -20
  59. package/dist/commands/slash-commands/slash-commands.service.d.ts +3 -3
  60. package/dist/commands/slash-commands/slash-commands.service.js +16 -16
  61. package/dist/context/decorators/context.decorator.js +4 -7
  62. package/dist/context/decorators/discovery.decorator.js +3 -6
  63. package/dist/context/decorators/index.d.ts +2 -2
  64. package/dist/context/decorators/index.js +2 -5
  65. package/dist/context/decorators/params.util.d.ts +1 -1
  66. package/dist/context/decorators/params.util.js +8 -8
  67. package/dist/context/index.d.ts +7 -7
  68. package/dist/context/index.js +7 -10
  69. package/dist/context/necord-arguments-host.d.ts +3 -3
  70. package/dist/context/necord-arguments-host.js +2 -6
  71. package/dist/context/necord-base.discovery.d.ts +6 -6
  72. package/dist/context/necord-base.discovery.js +3 -7
  73. package/dist/context/necord-context.interface.d.ts +1 -1
  74. package/dist/context/necord-context.interface.js +1 -2
  75. package/dist/context/necord-execution-context.d.ts +1 -1
  76. package/dist/context/necord-execution-context.js +2 -6
  77. package/dist/context/necord-params.factory.d.ts +3 -3
  78. package/dist/context/necord-params.factory.js +4 -8
  79. package/dist/context/necord-paramtype.enum.js +2 -5
  80. package/dist/index.d.ts +12 -12
  81. package/dist/index.js +12 -15
  82. package/dist/listeners/decorators/custom-listener.decorator.js +3 -6
  83. package/dist/listeners/decorators/index.d.ts +4 -4
  84. package/dist/listeners/decorators/index.js +4 -7
  85. package/dist/listeners/decorators/listener.decorator.d.ts +1 -1
  86. package/dist/listeners/decorators/listener.decorator.js +4 -7
  87. package/dist/listeners/decorators/on.decorator.d.ts +2 -2
  88. package/dist/listeners/decorators/on.decorator.js +4 -8
  89. package/dist/listeners/decorators/once.decorator.d.ts +2 -2
  90. package/dist/listeners/decorators/once.decorator.js +4 -8
  91. package/dist/listeners/handlers/base.handler.d.ts +1 -1
  92. package/dist/listeners/handlers/base.handler.js +7 -11
  93. package/dist/listeners/handlers/channel-update.handler.d.ts +2 -2
  94. package/dist/listeners/handlers/channel-update.handler.js +14 -17
  95. package/dist/listeners/handlers/guild-audit-log-entry-create.handler.d.ts +2 -2
  96. package/dist/listeners/handlers/guild-audit-log-entry-create.handler.js +19 -22
  97. package/dist/listeners/handlers/guild-member-update.handler.d.ts +14 -6
  98. package/dist/listeners/handlers/guild-member-update.handler.js +46 -39
  99. package/dist/listeners/handlers/guild-update.handler.d.ts +8 -4
  100. package/dist/listeners/handlers/guild-update.handler.js +34 -37
  101. package/dist/listeners/handlers/index.d.ts +11 -11
  102. package/dist/listeners/handlers/index.js +11 -14
  103. package/dist/listeners/handlers/message-update.handler.d.ts +2 -2
  104. package/dist/listeners/handlers/message-update.handler.js +19 -22
  105. package/dist/listeners/handlers/presence-update.handler.d.ts +2 -2
  106. package/dist/listeners/handlers/presence-update.handler.js +15 -18
  107. package/dist/listeners/handlers/role-update.handler.d.ts +5 -5
  108. package/dist/listeners/handlers/role-update.handler.js +24 -27
  109. package/dist/listeners/handlers/thread-update.handler.d.ts +6 -6
  110. package/dist/listeners/handlers/thread-update.handler.js +34 -37
  111. package/dist/listeners/handlers/user-update.handler.d.ts +6 -6
  112. package/dist/listeners/handlers/user-update.handler.js +34 -37
  113. package/dist/listeners/handlers/voice-state-update.handler.d.ts +2 -2
  114. package/dist/listeners/handlers/voice-state-update.handler.js +47 -34
  115. package/dist/listeners/index.d.ts +6 -6
  116. package/dist/listeners/index.js +6 -9
  117. package/dist/listeners/listener.discovery.d.ts +2 -2
  118. package/dist/listeners/listener.discovery.js +2 -6
  119. package/dist/listeners/listener.interface.d.ts +1 -1
  120. package/dist/listeners/listener.interface.js +1 -2
  121. package/dist/listeners/listeners.module.d.ts +4 -4
  122. package/dist/listeners/listeners.module.js +28 -28
  123. package/dist/listeners/scopes/async-custom-listener.context.d.ts +1 -1
  124. package/dist/listeners/scopes/async-custom-listener.context.js +6 -10
  125. package/dist/listeners/scopes/index.d.ts +1 -1
  126. package/dist/listeners/scopes/index.js +1 -4
  127. package/dist/message-components/decorators/button.decorator.js +3 -7
  128. package/dist/message-components/decorators/component-param.decorator.js +4 -7
  129. package/dist/message-components/decorators/index.d.ts +5 -5
  130. package/dist/message-components/decorators/index.js +5 -8
  131. package/dist/message-components/decorators/message-component.decorator.d.ts +1 -1
  132. package/dist/message-components/decorators/message-component.decorator.js +4 -7
  133. package/dist/message-components/decorators/select-menu.decorator.js +7 -15
  134. package/dist/message-components/decorators/selected.decorator.js +17 -20
  135. package/dist/message-components/index.d.ts +4 -4
  136. package/dist/message-components/index.js +4 -7
  137. package/dist/message-components/message-component.discovery.d.ts +1 -1
  138. package/dist/message-components/message-component.discovery.js +4 -8
  139. package/dist/message-components/message-components.module.d.ts +4 -4
  140. package/dist/message-components/message-components.module.js +16 -19
  141. package/dist/message-components/message-components.service.d.ts +2 -2
  142. package/dist/message-components/message-components.service.js +8 -11
  143. package/dist/modals/decorators/fields.decorator.js +4 -7
  144. package/dist/modals/decorators/index.d.ts +3 -3
  145. package/dist/modals/decorators/index.js +3 -6
  146. package/dist/modals/decorators/modal-param.decorator.js +4 -7
  147. package/dist/modals/decorators/modal.decorator.d.ts +1 -1
  148. package/dist/modals/decorators/modal.decorator.js +4 -7
  149. package/dist/modals/index.d.ts +4 -4
  150. package/dist/modals/index.js +4 -7
  151. package/dist/modals/modal.discovery.d.ts +1 -1
  152. package/dist/modals/modal.discovery.js +4 -8
  153. package/dist/modals/modals.module.d.ts +4 -4
  154. package/dist/modals/modals.module.js +16 -19
  155. package/dist/modals/modals.service.d.ts +2 -2
  156. package/dist/modals/modals.service.js +8 -11
  157. package/dist/necord-context.creator.d.ts +1 -1
  158. package/dist/necord-context.creator.js +29 -24
  159. package/dist/necord-explorer.service.d.ts +2 -2
  160. package/dist/necord-explorer.service.js +28 -21
  161. package/dist/necord-options.interface.d.ts +4 -0
  162. package/dist/necord-options.interface.js +1 -2
  163. package/dist/necord.module-definition.d.ts +1 -1
  164. package/dist/necord.module-definition.js +3 -7
  165. package/dist/necord.module.d.ts +4 -4
  166. package/dist/necord.module.js +35 -38
  167. package/dist/providers/channels.provider.d.ts +1 -1
  168. package/dist/providers/channels.provider.js +4 -7
  169. package/dist/providers/client.provider.js +6 -9
  170. package/dist/providers/guilds.provider.d.ts +1 -1
  171. package/dist/providers/guilds.provider.js +4 -7
  172. package/dist/providers/index.d.ts +8 -8
  173. package/dist/providers/index.js +8 -11
  174. package/dist/providers/rest.provider.js +4 -7
  175. package/dist/providers/shard.provider.d.ts +2 -2
  176. package/dist/providers/shard.provider.js +4 -7
  177. package/dist/providers/users.provider.d.ts +1 -1
  178. package/dist/providers/users.provider.js +4 -7
  179. package/dist/providers/voice.provider.d.ts +1 -1
  180. package/dist/providers/voice.provider.js +4 -7
  181. package/dist/providers/ws.provider.d.ts +1 -1
  182. package/dist/providers/ws.provider.js +4 -7
  183. package/dist/scopes/async.context.d.ts +1 -1
  184. package/dist/scopes/async.context.js +10 -14
  185. package/dist/scopes/index.d.ts +1 -1
  186. package/dist/scopes/index.js +1 -4
  187. package/dist/text-commands/decorators/arguments.decorator.js +5 -8
  188. package/dist/text-commands/decorators/index.d.ts +2 -2
  189. package/dist/text-commands/decorators/index.js +2 -5
  190. package/dist/text-commands/decorators/text-command.decorator.d.ts +1 -1
  191. package/dist/text-commands/decorators/text-command.decorator.js +4 -7
  192. package/dist/text-commands/index.d.ts +4 -4
  193. package/dist/text-commands/index.js +4 -7
  194. package/dist/text-commands/text-command.discovery.d.ts +3 -1
  195. package/dist/text-commands/text-command.discovery.js +5 -6
  196. package/dist/text-commands/text-commands.module.d.ts +6 -6
  197. package/dist/text-commands/text-commands.module.js +29 -24
  198. package/dist/text-commands/text-commands.service.d.ts +2 -2
  199. package/dist/text-commands/text-commands.service.js +16 -12
  200. package/package.json +42 -33
  201. package/.husky/commit-msg +0 -1
  202. package/.husky/pre-commit +0 -1
  203. package/.prettierrc +0 -8
  204. package/.release-it.json +0 -74
  205. package/CHANGELOG.md +0 -461
  206. package/coverage/clover.xml +0 -1794
  207. package/coverage/coverage-final.json +0 -113
  208. package/coverage/lcov-report/base.css +0 -224
  209. package/coverage/lcov-report/block-navigation.js +0 -87
  210. package/coverage/lcov-report/favicon.png +0 -0
  211. package/coverage/lcov-report/index.html +0 -431
  212. package/coverage/lcov-report/prettify.css +0 -1
  213. package/coverage/lcov-report/prettify.js +0 -2
  214. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  215. package/coverage/lcov-report/sorter.js +0 -210
  216. package/coverage/lcov.info +0 -3295
  217. package/eslint.config.mjs +0 -53
  218. package/jest.config.json +0 -16
  219. package/tsconfig.json +0 -30
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UsersProvider = void 0;
4
- const discord_js_1 = require("discord.js");
5
- exports.UsersProvider = {
6
- provide: discord_js_1.UserManager,
1
+ import { Client, UserManager } from 'discord.js';
2
+ export const UsersProvider = {
3
+ provide: UserManager,
7
4
  useFactory: (client) => client.users,
8
- inject: [discord_js_1.Client]
5
+ inject: [Client]
9
6
  };
@@ -1,3 +1,3 @@
1
- import { Provider } from '@nestjs/common';
2
1
  import { ClientVoiceManager } from 'discord.js';
2
+ import { Provider } from '@nestjs/common';
3
3
  export declare const VoiceProvider: Provider<ClientVoiceManager>;
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VoiceProvider = void 0;
4
- const discord_js_1 = require("discord.js");
5
- exports.VoiceProvider = {
6
- provide: discord_js_1.ClientVoiceManager,
1
+ import { Client, ClientVoiceManager } from 'discord.js';
2
+ export const VoiceProvider = {
3
+ provide: ClientVoiceManager,
7
4
  useFactory: (client) => client.voice,
8
- inject: [discord_js_1.Client]
5
+ inject: [Client]
9
6
  };
@@ -1,3 +1,3 @@
1
- import { Provider } from '@nestjs/common';
2
1
  import { WebSocketManager } from 'discord.js';
2
+ import { Provider } from '@nestjs/common';
3
3
  export declare const WsProvider: Provider<WebSocketManager>;
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WsProvider = void 0;
4
- const discord_js_1 = require("discord.js");
5
- exports.WsProvider = {
6
- provide: discord_js_1.WebSocketManager,
1
+ import { Client, WebSocketManager } from 'discord.js';
2
+ export const WsProvider = {
3
+ provide: WebSocketManager,
7
4
  useFactory: (client) => client.ws,
8
- inject: [discord_js_1.Client]
5
+ inject: [Client]
9
6
  };
@@ -12,7 +12,7 @@ export declare class AsyncContext {
12
12
  /**
13
13
  * Checks if target is already attached to any async context.
14
14
  * @param target The object to check.
15
- * @returns "true" if the target is attached to an async context, "false" otherwise.
15
+ * @returns "true" if the target is attached to any async context.
16
16
  */
17
17
  static isAttached(target: object): boolean;
18
18
  /**
@@ -1,21 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AsyncContext = exports.ASYNC_CONTEXT_ATTRIBUTE = void 0;
4
- const core_1 = require("@nestjs/core");
5
- exports.ASYNC_CONTEXT_ATTRIBUTE = Symbol('ASYNC_CONTEXT_ATTRIBUTE');
1
+ import { ContextIdFactory } from '@nestjs/core';
2
+ export const ASYNC_CONTEXT_ATTRIBUTE = Symbol('ASYNC_CONTEXT_ATTRIBUTE');
6
3
  /**
7
4
  * Represents the context of an asynchronous operation.
8
5
  */
9
- class AsyncContext {
6
+ export class AsyncContext {
10
7
  constructor() {
11
- this.id = core_1.ContextIdFactory.create();
8
+ this.id = ContextIdFactory.create();
12
9
  }
13
10
  /**
14
11
  * Attaches the context to an object.
15
12
  * @param target The object to attach the context to.
16
13
  */
17
14
  attachTo(target) {
18
- Object.defineProperty(target, exports.ASYNC_CONTEXT_ATTRIBUTE, {
15
+ Object.defineProperty(target, ASYNC_CONTEXT_ATTRIBUTE, {
19
16
  value: this,
20
17
  enumerable: false
21
18
  });
@@ -23,10 +20,10 @@ class AsyncContext {
23
20
  /**
24
21
  * Checks if target is already attached to any async context.
25
22
  * @param target The object to check.
26
- * @returns "true" if the target is attached to an async context, "false" otherwise.
23
+ * @returns "true" if the target is attached to any async context.
27
24
  */
28
25
  static isAttached(target) {
29
- return !!target[exports.ASYNC_CONTEXT_ATTRIBUTE];
26
+ return !!target[ASYNC_CONTEXT_ATTRIBUTE];
30
27
  }
31
28
  /**
32
29
  * Merges the context of an asynchronous operation from a given command, query, or event to another object.
@@ -37,11 +34,11 @@ class AsyncContext {
37
34
  if (!from || !to) {
38
35
  return;
39
36
  }
40
- const fromContext = from[exports.ASYNC_CONTEXT_ATTRIBUTE];
37
+ const fromContext = from[ASYNC_CONTEXT_ATTRIBUTE];
41
38
  if (!fromContext) {
42
39
  return;
43
40
  }
44
- Object.defineProperty(to, exports.ASYNC_CONTEXT_ATTRIBUTE, {
41
+ Object.defineProperty(to, ASYNC_CONTEXT_ATTRIBUTE, {
45
42
  value: fromContext,
46
43
  enumerable: false
47
44
  });
@@ -52,7 +49,6 @@ class AsyncContext {
52
49
  * @returns An "AsyncContext" instance or "undefined" if the context is not found.
53
50
  */
54
51
  static of(target) {
55
- return target[exports.ASYNC_CONTEXT_ATTRIBUTE];
52
+ return target[ASYNC_CONTEXT_ATTRIBUTE];
56
53
  }
57
54
  }
58
- exports.AsyncContext = AsyncContext;
@@ -1 +1 @@
1
- export * from './async.context';
1
+ export * from './async.context.js';
@@ -1,4 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./async.context"), exports);
1
+ export * from './async.context.js';
@@ -1,20 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Args = exports.Arguments = void 0;
4
- const common_1 = require("@nestjs/common");
5
- const context_1 = require("../../context");
1
+ import { createParamDecorator } from '@nestjs/common';
2
+ import { NecordExecutionContext } from '../../context/index.js';
6
3
  /**
7
4
  * Represents an arguments param decorator.
8
5
  * @url https://necord.org/text-commands
9
6
  * @returns The arguments param decorator.
10
7
  * @url https://necord.org/text-commands#arguments
11
8
  */
12
- exports.Arguments = (0, common_1.createParamDecorator)((_, context) => {
13
- const necordContext = context_1.NecordExecutionContext.create(context);
9
+ export const Arguments = createParamDecorator((_, context) => {
10
+ const necordContext = NecordExecutionContext.create(context);
14
11
  const [message] = necordContext.getContext();
15
12
  const discovery = necordContext.getDiscovery();
16
13
  if (!discovery.isTextCommand())
17
14
  return null;
18
15
  return message.content.split(/ +/g).slice(1);
19
16
  });
20
- exports.Args = exports.Arguments;
17
+ export const Args = Arguments;
@@ -1,2 +1,2 @@
1
- export * from './arguments.decorator';
2
- export * from './text-command.decorator';
1
+ export * from './arguments.decorator.js';
2
+ export * from './text-command.decorator.js';
@@ -1,5 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./arguments.decorator"), exports);
5
- tslib_1.__exportStar(require("./text-command.decorator"), exports);
1
+ export * from './arguments.decorator.js';
2
+ export * from './text-command.decorator.js';
@@ -1,4 +1,4 @@
1
- import { TextCommandDiscovery, TextCommandMeta } from '../text-command.discovery';
1
+ import { TextCommandDiscovery, TextCommandMeta } from '../text-command.discovery.js';
2
2
  /**
3
3
  * Decorator that marks a method as a text command for discord.js client.
4
4
  * @param options The options for the text command.
@@ -1,13 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TextCommand = void 0;
4
- const text_command_discovery_1 = require("../text-command.discovery");
5
- const core_1 = require("@nestjs/core");
1
+ import { Reflector } from '@nestjs/core';
2
+ import { TextCommandDiscovery } from '../text-command.discovery.js';
6
3
  /**
7
4
  * Decorator that marks a method as a text command for discord.js client.
8
5
  * @param options The options for the text command.
9
6
  * @url https://necord.org/text-commands
10
7
  */
11
- exports.TextCommand = core_1.Reflector.createDecorator({
12
- transform: (options) => new text_command_discovery_1.TextCommandDiscovery(options)
8
+ export const TextCommand = Reflector.createDecorator({
9
+ transform: (options) => new TextCommandDiscovery(options)
13
10
  });
@@ -1,4 +1,4 @@
1
- export * from './decorators';
2
- export * from './text-command.discovery';
3
- export * from './text-commands.module';
4
- export * from './text-commands.service';
1
+ export * from './decorators/index.js';
2
+ export * from './text-command.discovery.js';
3
+ export * from './text-commands.module.js';
4
+ export * from './text-commands.service.js';
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./decorators"), exports);
5
- tslib_1.__exportStar(require("./text-command.discovery"), exports);
6
- tslib_1.__exportStar(require("./text-commands.module"), exports);
7
- tslib_1.__exportStar(require("./text-commands.service"), exports);
1
+ export * from './decorators/index.js';
2
+ export * from './text-command.discovery.js';
3
+ export * from './text-commands.module.js';
4
+ export * from './text-commands.service.js';
@@ -1,7 +1,8 @@
1
- import { NecordBaseDiscovery } from '../context';
1
+ import { NecordBaseDiscovery } from '../context/index.js';
2
2
  export interface TextCommandMeta {
3
3
  name: string;
4
4
  description: string;
5
+ aliases?: string[];
5
6
  }
6
7
  /**
7
8
  * Represents a text command discovery.
@@ -9,6 +10,7 @@ export interface TextCommandMeta {
9
10
  export declare class TextCommandDiscovery extends NecordBaseDiscovery<TextCommandMeta> {
10
11
  getName(): string;
11
12
  getDescription(): string;
13
+ getAliases(): string[];
12
14
  isTextCommand(): this is TextCommandDiscovery;
13
15
  toJSON(): Record<string, any>;
14
16
  }
@@ -1,17 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TextCommandDiscovery = void 0;
4
- const context_1 = require("../context");
1
+ import { NecordBaseDiscovery } from '../context/index.js';
5
2
  /**
6
3
  * Represents a text command discovery.
7
4
  */
8
- class TextCommandDiscovery extends context_1.NecordBaseDiscovery {
5
+ export class TextCommandDiscovery extends NecordBaseDiscovery {
9
6
  getName() {
10
7
  return this.meta.name;
11
8
  }
12
9
  getDescription() {
13
10
  return this.meta.description;
14
11
  }
12
+ getAliases() {
13
+ return this.meta.aliases ?? [];
14
+ }
15
15
  isTextCommand() {
16
16
  return true;
17
17
  }
@@ -19,4 +19,3 @@ class TextCommandDiscovery extends context_1.NecordBaseDiscovery {
19
19
  return this.meta;
20
20
  }
21
21
  }
22
- exports.TextCommandDiscovery = TextCommandDiscovery;
@@ -1,15 +1,15 @@
1
1
  import { OnApplicationBootstrap, OnModuleInit } from '@nestjs/common';
2
- import { TextCommandsService } from './text-commands.service';
3
- import { NecordModuleOptions } from '../necord-options.interface';
4
2
  import { Client } from 'discord.js';
5
- import { NecordExplorerService } from '../necord-explorer.service';
6
- import { TextCommandDiscovery } from './text-command.discovery';
7
- export declare class TextCommandsModule implements OnModuleInit, OnApplicationBootstrap {
3
+ import { NecordExplorerService } from '../necord-explorer.service.js';
4
+ import { NecordModuleOptions } from '../necord-options.interface.js';
5
+ import { TextCommandDiscovery } from './text-command.discovery.js';
6
+ import { TextCommandsService } from './text-commands.service.js';
7
+ export declare class TextCommandsModule implements OnApplicationBootstrap, OnModuleInit {
8
8
  private readonly options;
9
9
  private readonly client;
10
10
  private readonly explorerService;
11
11
  private readonly textCommandsService;
12
12
  constructor(options: NecordModuleOptions, client: Client, explorerService: NecordExplorerService<TextCommandDiscovery>, textCommandsService: TextCommandsService);
13
- onModuleInit(): void;
13
+ onModuleInit(): Promise<void>;
14
14
  onApplicationBootstrap(): Client<boolean>;
15
15
  }
@@ -1,13 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TextCommandsModule = void 0;
4
- const tslib_1 = require("tslib");
5
- const common_1 = require("@nestjs/common");
6
- const text_commands_service_1 = require("./text-commands.service");
7
- const decorators_1 = require("./decorators");
8
- const necord_module_definition_1 = require("../necord.module-definition");
9
- const discord_js_1 = require("discord.js");
10
- const necord_explorer_service_1 = require("../necord-explorer.service");
1
+ import { __decorate, __metadata, __param } from "tslib";
2
+ import { Global, Inject, Module } from '@nestjs/common';
3
+ import { Client } from 'discord.js';
4
+ import { NECORD_MODULE_OPTIONS } from '../necord.module-definition.js';
5
+ import { NecordExplorerService } from '../necord-explorer.service.js';
6
+ import { TextCommandsService } from './text-commands.service.js';
7
+ import { TextCommand } from './decorators/index.js';
11
8
  let TextCommandsModule = class TextCommandsModule {
12
9
  constructor(options, client, explorerService, textCommandsService) {
13
10
  this.options = options;
@@ -15,9 +12,9 @@ let TextCommandsModule = class TextCommandsModule {
15
12
  this.explorerService = explorerService;
16
13
  this.textCommandsService = textCommandsService;
17
14
  }
18
- onModuleInit() {
15
+ async onModuleInit() {
19
16
  return this.explorerService
20
- .explore(decorators_1.TextCommand.KEY)
17
+ .explore(TextCommand.KEY)
21
18
  .forEach(textCommand => this.textCommandsService.add(textCommand));
22
19
  }
23
20
  onApplicationBootstrap() {
@@ -28,9 +25,17 @@ let TextCommandsModule = class TextCommandsModule {
28
25
  const prefix = typeof this.options.prefix !== 'function'
29
26
  ? (this.options.prefix ?? '!')
30
27
  : await this.options.prefix(message);
31
- if (!prefix || !content.startsWith(prefix))
28
+ let contentWithoutPrefix = '';
29
+ const hasPrefix = prefix && content.startsWith(prefix);
30
+ if (hasPrefix) {
31
+ contentWithoutPrefix = content.slice(prefix.length);
32
+ }
33
+ else if (this.options.allowTextCommandsWithoutPrefix) {
34
+ contentWithoutPrefix = content;
35
+ }
36
+ if (!contentWithoutPrefix)
32
37
  return;
33
- const args = content.substring(prefix.length).split(/ +/g);
38
+ const args = contentWithoutPrefix.trim().split(/ +/g);
34
39
  const cmd = args.shift();
35
40
  if (!cmd)
36
41
  return;
@@ -38,15 +43,15 @@ let TextCommandsModule = class TextCommandsModule {
38
43
  });
39
44
  }
40
45
  };
41
- exports.TextCommandsModule = TextCommandsModule;
42
- exports.TextCommandsModule = TextCommandsModule = tslib_1.__decorate([
43
- (0, common_1.Global)(),
44
- (0, common_1.Module)({
45
- providers: [text_commands_service_1.TextCommandsService],
46
- exports: [text_commands_service_1.TextCommandsService]
46
+ TextCommandsModule = __decorate([
47
+ Global(),
48
+ Module({
49
+ providers: [TextCommandsService],
50
+ exports: [TextCommandsService]
47
51
  }),
48
- tslib_1.__param(0, (0, common_1.Inject)(necord_module_definition_1.NECORD_MODULE_OPTIONS)),
49
- tslib_1.__metadata("design:paramtypes", [Object, discord_js_1.Client,
50
- necord_explorer_service_1.NecordExplorerService,
51
- text_commands_service_1.TextCommandsService])
52
+ __param(0, Inject(NECORD_MODULE_OPTIONS)),
53
+ __metadata("design:paramtypes", [Object, Client,
54
+ NecordExplorerService,
55
+ TextCommandsService])
52
56
  ], TextCommandsModule);
57
+ export { TextCommandsModule };
@@ -1,5 +1,5 @@
1
1
  import { Collection } from 'discord.js';
2
- import { TextCommandDiscovery } from './text-command.discovery';
2
+ import { TextCommandDiscovery } from './text-command.discovery.js';
3
3
  /**
4
4
  * Service that manages text commands.
5
5
  */
@@ -7,6 +7,6 @@ export declare class TextCommandsService {
7
7
  private readonly logger;
8
8
  readonly cache: Collection<string, TextCommandDiscovery>;
9
9
  add(textCommand: TextCommandDiscovery): void;
10
- get(name: string): TextCommandDiscovery;
10
+ get(name: string): TextCommandDiscovery | undefined;
11
11
  remove(name: string): void;
12
12
  }
@@ -1,24 +1,28 @@
1
- "use strict";
2
1
  var TextCommandsService_1;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.TextCommandsService = void 0;
5
- const tslib_1 = require("tslib");
6
- const common_1 = require("@nestjs/common");
7
- const discord_js_1 = require("discord.js");
2
+ import { __decorate } from "tslib";
3
+ import { Injectable, Logger } from '@nestjs/common';
4
+ import { Collection } from 'discord.js';
8
5
  /**
9
6
  * Service that manages text commands.
10
7
  */
11
8
  let TextCommandsService = TextCommandsService_1 = class TextCommandsService {
12
9
  constructor() {
13
- this.logger = new common_1.Logger(TextCommandsService_1.name);
14
- this.cache = new discord_js_1.Collection();
10
+ this.logger = new Logger(TextCommandsService_1.name);
11
+ this.cache = new Collection();
15
12
  }
16
13
  add(textCommand) {
17
14
  const name = textCommand.getName();
15
+ const aliases = textCommand.getAliases();
18
16
  if (this.cache.has(name)) {
19
17
  this.logger.warn(`TextCommand : ${name} already exists`);
20
18
  }
21
- this.cache.set(name, textCommand);
19
+ const variants = [name, ...aliases];
20
+ for (const variant of variants) {
21
+ if (this.cache.has(variant)) {
22
+ this.logger.warn(`TextCommand : ${variant} already exists`);
23
+ }
24
+ this.cache.set(variant, textCommand);
25
+ }
22
26
  }
23
27
  get(name) {
24
28
  return this.cache.get(name);
@@ -27,7 +31,7 @@ let TextCommandsService = TextCommandsService_1 = class TextCommandsService {
27
31
  this.cache.delete(name);
28
32
  }
29
33
  };
30
- exports.TextCommandsService = TextCommandsService;
31
- exports.TextCommandsService = TextCommandsService = TextCommandsService_1 = tslib_1.__decorate([
32
- (0, common_1.Injectable)()
34
+ TextCommandsService = TextCommandsService_1 = __decorate([
35
+ Injectable()
33
36
  ], TextCommandsService);
37
+ export { TextCommandsService };
package/package.json CHANGED
@@ -1,9 +1,11 @@
1
1
  {
2
2
  "name": "necord",
3
3
  "description": "A module for creating Discord bots using NestJS, based on Discord.js",
4
- "version": "6.13.0",
4
+ "version": "7.0.0",
5
+ "type": "module",
5
6
  "scripts": {
6
7
  "build": "rimraf dist && tsc -p tsconfig.build.json",
8
+ "typecheck": "tsc -p tsconfig.json --noEmit",
7
9
  "prepublish:npm": "npm run build",
8
10
  "publish:npm": "release-it",
9
11
  "prepublish:dev": "npm run build",
@@ -11,11 +13,12 @@
11
13
  "prepare": "husky",
12
14
  "postinstall": "opencollective",
13
15
  "format": "prettier --write \"{src,apps,libs,test}/**/*.ts\"",
14
- "lint": "eslint --ignore-pattern .gitignore \"{src,apps,libs,test}/**/*.ts\"",
15
- "test": "jest",
16
- "test:watch": "jest --watch",
17
- "test:cov": "jest --coverage",
18
- "test:ci": "jest --ci --passWithNoTests --coverage"
16
+ "lint": "oxlint --type-aware --deny-warnings src test",
17
+ "test": "vitest run",
18
+ "test:watch": "vitest",
19
+ "test:cov": "vitest run --coverage",
20
+ "test:ci": "vitest run --coverage",
21
+ "test:package": "npm run build && npm pack --dry-run && node --input-type=module --eval \"await import('necord')\" && node --eval \"require('necord')\""
19
22
  },
20
23
  "lint-staged": {
21
24
  "*.ts": [
@@ -40,6 +43,16 @@
40
43
  },
41
44
  "main": "./dist/index.js",
42
45
  "types": "./dist/index.d.ts",
46
+ "exports": {
47
+ ".": {
48
+ "types": "./dist/index.d.ts",
49
+ "default": "./dist/index.js"
50
+ },
51
+ "./package.json": "./package.json"
52
+ },
53
+ "files": [
54
+ "dist"
55
+ ],
43
56
  "keywords": [
44
57
  "nest",
45
58
  "nestjs",
@@ -56,7 +69,7 @@
56
69
  "homepage": "https://necord.org",
57
70
  "repository": {
58
71
  "type": "git",
59
- "url": "https://github.com/necordjs/necord"
72
+ "url": "git+https://github.com/necordjs/necord.git"
60
73
  },
61
74
  "bugs": {
62
75
  "url": "https://github.com/necordjs/necord/issues"
@@ -71,46 +84,42 @@
71
84
  "tslib": "^2.8.1"
72
85
  },
73
86
  "devDependencies": {
74
- "@commitlint/cli": "20.5.0",
75
- "@commitlint/config-angular": "20.5.0",
76
- "@eslint/eslintrc": "^3.2.0",
77
- "@eslint/js": "^10.0.1",
78
- "@nestjs/common": "11.1.19",
79
- "@nestjs/core": "^11.1.6",
80
- "@nestjs/testing": "^11.1.0",
81
- "@release-it/conventional-changelog": "^10.0.0",
82
- "@types/jest": "^30.0.0",
83
- "@types/node": "25.6.0",
84
- "discord-api-types": "0.38.47",
85
- "discord.js": "14.26.3",
87
+ "@commitlint/cli": "21.2.2",
88
+ "@commitlint/config-angular": "21.2.2",
89
+ "@nestjs/common": "12.0.1",
90
+ "@nestjs/core": "12.0.1",
91
+ "@nestjs/testing": "12.0.1",
92
+ "@release-it/conventional-changelog": "^12.0.0",
93
+ "@types/node": "26.4.0",
94
+ "@vitest/coverage-v8": "4.1.11",
95
+ "discord-api-types": "0.38.54",
96
+ "discord.js": "14.27.0",
86
97
  "eslint": "^10.0.0",
87
- "eslint-config-prettier": "10.1.8",
88
- "eslint-plugin-import": "^2.31.0",
89
- "eslint-plugin-prettier": "5.5.5",
90
- "globals": "^17.0.0",
98
+ "eslint-plugin-perfectionist": "5.11.0",
99
+ "eslint-plugin-prettier": "5.5.6",
91
100
  "husky": "9.1.7",
92
- "jest": "^30.1.2",
93
- "lint-staged": "16.4.0",
94
- "prettier": "3.8.3",
101
+ "lint-staged": "17.4.1",
102
+ "oxlint": "1.81.0",
103
+ "oxlint-tsgolint": "7.0.2001",
104
+ "prettier": "3.9.6",
95
105
  "reflect-metadata": "0.2.2",
96
- "release-it": "20.0.0",
106
+ "release-it": "21.0.2",
97
107
  "rimraf": "6.1.3",
98
108
  "rxjs": "7.8.2",
99
- "ts-jest": "^29.3.2",
100
109
  "ts-node": "10.9.2",
101
- "typescript": "6.0.3",
102
- "typescript-eslint": "^8.21.0"
110
+ "typescript": "7.0.2",
111
+ "vitest": "4.1.11"
103
112
  },
104
113
  "peerDependencies": {
105
- "@nestjs/common": "^10.2.0 || ^11.0.0",
106
- "@nestjs/core": "^10.2.0 || ^11.0.0",
114
+ "@nestjs/common": "^10.2.0 || ^11.0.0 || ^12.0.0",
115
+ "@nestjs/core": "^10.2.0 || ^11.0.0 || ^12.0.0",
107
116
  "discord-api-types": "^0.37.99",
108
117
  "discord.js": "^14.0.1",
109
118
  "reflect-metadata": "^0.2.1",
110
119
  "rxjs": "^7.2.0"
111
120
  },
112
121
  "engines": {
113
- "node": ">=18",
122
+ "node": "^20.19.0 || >=22.13.0",
114
123
  "npm": ">=8.6.0"
115
124
  }
116
125
  }
package/.husky/commit-msg DELETED
@@ -1 +0,0 @@
1
- npx commitlint --config .commitlintrc.json --edit $HUSKY_GIT_PARAMS
package/.husky/pre-commit DELETED
@@ -1 +0,0 @@
1
- npx lint-staged
package/.prettierrc DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "parser": "typescript",
3
- "trailingComma": "none",
4
- "singleQuote": true,
5
- "arrowParens": "avoid",
6
- "endOfLine": "auto",
7
- "printWidth": 100
8
- }