necord 6.14.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 (211) 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 +3 -3
  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 +1 -1
  8. package/dist/commands/context-menus/context-menu.discovery.js +2 -6
  9. package/dist/commands/context-menus/context-menus.module.d.ts +3 -3
  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.js +9 -12
  27. package/dist/commands/slash-commands/autocomplete/index.d.ts +1 -1
  28. package/dist/commands/slash-commands/autocomplete/index.js +1 -4
  29. package/dist/commands/slash-commands/decorators/index.d.ts +3 -3
  30. package/dist/commands/slash-commands/decorators/index.js +3 -6
  31. package/dist/commands/slash-commands/decorators/slash-command.decorator.d.ts +2 -2
  32. package/dist/commands/slash-commands/decorators/slash-command.decorator.js +6 -9
  33. package/dist/commands/slash-commands/decorators/subcommand-group.decorator.d.ts +3 -3
  34. package/dist/commands/slash-commands/decorators/subcommand-group.decorator.js +13 -17
  35. package/dist/commands/slash-commands/decorators/subcommand.decorator.d.ts +2 -2
  36. package/dist/commands/slash-commands/decorators/subcommand.decorator.js +6 -9
  37. package/dist/commands/slash-commands/index.d.ts +6 -6
  38. package/dist/commands/slash-commands/index.js +6 -9
  39. package/dist/commands/slash-commands/options/attachment-option.decorator.js +3 -6
  40. package/dist/commands/slash-commands/options/boolean-option.decorator.js +3 -6
  41. package/dist/commands/slash-commands/options/channel-option.decorator.js +3 -6
  42. package/dist/commands/slash-commands/options/index.d.ts +12 -12
  43. package/dist/commands/slash-commands/options/index.js +12 -15
  44. package/dist/commands/slash-commands/options/integer-option.decorator.js +3 -6
  45. package/dist/commands/slash-commands/options/member-option.decorator.js +3 -6
  46. package/dist/commands/slash-commands/options/mentionable-option.decorator.js +3 -6
  47. package/dist/commands/slash-commands/options/number-option.decorator.js +3 -6
  48. package/dist/commands/slash-commands/options/option.util.d.ts +2 -2
  49. package/dist/commands/slash-commands/options/option.util.js +5 -10
  50. package/dist/commands/slash-commands/options/options.decorator.js +22 -14
  51. package/dist/commands/slash-commands/options/role-option.decorator.js +3 -6
  52. package/dist/commands/slash-commands/options/string-option.decorator.js +3 -6
  53. package/dist/commands/slash-commands/options/user-option.decorator.js +3 -6
  54. package/dist/commands/slash-commands/slash-command.discovery.d.ts +3 -32
  55. package/dist/commands/slash-commands/slash-command.discovery.js +7 -10
  56. package/dist/commands/slash-commands/slash-commands.module.d.ts +3 -3
  57. package/dist/commands/slash-commands/slash-commands.module.js +17 -20
  58. package/dist/commands/slash-commands/slash-commands.service.d.ts +2 -2
  59. package/dist/commands/slash-commands/slash-commands.service.js +16 -16
  60. package/dist/context/decorators/context.decorator.js +4 -7
  61. package/dist/context/decorators/discovery.decorator.js +3 -6
  62. package/dist/context/decorators/index.d.ts +2 -2
  63. package/dist/context/decorators/index.js +2 -5
  64. package/dist/context/decorators/params.util.d.ts +1 -1
  65. package/dist/context/decorators/params.util.js +8 -8
  66. package/dist/context/index.d.ts +7 -7
  67. package/dist/context/index.js +7 -10
  68. package/dist/context/necord-arguments-host.d.ts +3 -3
  69. package/dist/context/necord-arguments-host.js +2 -6
  70. package/dist/context/necord-base.discovery.d.ts +6 -6
  71. package/dist/context/necord-base.discovery.js +3 -7
  72. package/dist/context/necord-context.interface.d.ts +1 -1
  73. package/dist/context/necord-context.interface.js +1 -2
  74. package/dist/context/necord-execution-context.d.ts +1 -1
  75. package/dist/context/necord-execution-context.js +2 -6
  76. package/dist/context/necord-params.factory.d.ts +3 -3
  77. package/dist/context/necord-params.factory.js +4 -8
  78. package/dist/context/necord-paramtype.enum.js +2 -5
  79. package/dist/index.d.ts +12 -12
  80. package/dist/index.js +12 -15
  81. package/dist/listeners/decorators/custom-listener.decorator.js +3 -6
  82. package/dist/listeners/decorators/index.d.ts +4 -4
  83. package/dist/listeners/decorators/index.js +4 -7
  84. package/dist/listeners/decorators/listener.decorator.d.ts +1 -1
  85. package/dist/listeners/decorators/listener.decorator.js +4 -7
  86. package/dist/listeners/decorators/on.decorator.d.ts +2 -2
  87. package/dist/listeners/decorators/on.decorator.js +4 -8
  88. package/dist/listeners/decorators/once.decorator.d.ts +2 -2
  89. package/dist/listeners/decorators/once.decorator.js +4 -8
  90. package/dist/listeners/handlers/base.handler.d.ts +1 -1
  91. package/dist/listeners/handlers/base.handler.js +7 -11
  92. package/dist/listeners/handlers/channel-update.handler.d.ts +2 -2
  93. package/dist/listeners/handlers/channel-update.handler.js +14 -17
  94. package/dist/listeners/handlers/guild-audit-log-entry-create.handler.d.ts +2 -2
  95. package/dist/listeners/handlers/guild-audit-log-entry-create.handler.js +19 -22
  96. package/dist/listeners/handlers/guild-member-update.handler.d.ts +14 -6
  97. package/dist/listeners/handlers/guild-member-update.handler.js +46 -39
  98. package/dist/listeners/handlers/guild-update.handler.d.ts +8 -4
  99. package/dist/listeners/handlers/guild-update.handler.js +34 -37
  100. package/dist/listeners/handlers/index.d.ts +11 -11
  101. package/dist/listeners/handlers/index.js +11 -14
  102. package/dist/listeners/handlers/message-update.handler.d.ts +2 -2
  103. package/dist/listeners/handlers/message-update.handler.js +19 -22
  104. package/dist/listeners/handlers/presence-update.handler.d.ts +2 -2
  105. package/dist/listeners/handlers/presence-update.handler.js +15 -18
  106. package/dist/listeners/handlers/role-update.handler.d.ts +5 -5
  107. package/dist/listeners/handlers/role-update.handler.js +24 -27
  108. package/dist/listeners/handlers/thread-update.handler.d.ts +6 -6
  109. package/dist/listeners/handlers/thread-update.handler.js +34 -37
  110. package/dist/listeners/handlers/user-update.handler.d.ts +6 -6
  111. package/dist/listeners/handlers/user-update.handler.js +34 -37
  112. package/dist/listeners/handlers/voice-state-update.handler.d.ts +2 -2
  113. package/dist/listeners/handlers/voice-state-update.handler.js +47 -34
  114. package/dist/listeners/index.d.ts +6 -6
  115. package/dist/listeners/index.js +6 -9
  116. package/dist/listeners/listener.discovery.d.ts +2 -2
  117. package/dist/listeners/listener.discovery.js +2 -6
  118. package/dist/listeners/listener.interface.d.ts +1 -1
  119. package/dist/listeners/listener.interface.js +1 -2
  120. package/dist/listeners/listeners.module.d.ts +2 -2
  121. package/dist/listeners/listeners.module.js +28 -28
  122. package/dist/listeners/scopes/async-custom-listener.context.js +6 -10
  123. package/dist/listeners/scopes/index.d.ts +1 -1
  124. package/dist/listeners/scopes/index.js +1 -4
  125. package/dist/message-components/decorators/button.decorator.js +3 -7
  126. package/dist/message-components/decorators/component-param.decorator.js +4 -7
  127. package/dist/message-components/decorators/index.d.ts +5 -5
  128. package/dist/message-components/decorators/index.js +5 -8
  129. package/dist/message-components/decorators/message-component.decorator.d.ts +1 -1
  130. package/dist/message-components/decorators/message-component.decorator.js +4 -7
  131. package/dist/message-components/decorators/select-menu.decorator.js +7 -15
  132. package/dist/message-components/decorators/selected.decorator.js +17 -20
  133. package/dist/message-components/index.d.ts +4 -4
  134. package/dist/message-components/index.js +4 -7
  135. package/dist/message-components/message-component.discovery.d.ts +1 -1
  136. package/dist/message-components/message-component.discovery.js +4 -8
  137. package/dist/message-components/message-components.module.d.ts +3 -3
  138. package/dist/message-components/message-components.module.js +16 -19
  139. package/dist/message-components/message-components.service.d.ts +2 -2
  140. package/dist/message-components/message-components.service.js +8 -11
  141. package/dist/modals/decorators/fields.decorator.js +4 -7
  142. package/dist/modals/decorators/index.d.ts +3 -3
  143. package/dist/modals/decorators/index.js +3 -6
  144. package/dist/modals/decorators/modal-param.decorator.js +4 -7
  145. package/dist/modals/decorators/modal.decorator.d.ts +1 -1
  146. package/dist/modals/decorators/modal.decorator.js +4 -7
  147. package/dist/modals/index.d.ts +4 -4
  148. package/dist/modals/index.js +4 -7
  149. package/dist/modals/modal.discovery.d.ts +1 -1
  150. package/dist/modals/modal.discovery.js +4 -8
  151. package/dist/modals/modals.module.d.ts +3 -3
  152. package/dist/modals/modals.module.js +16 -19
  153. package/dist/modals/modals.service.d.ts +2 -2
  154. package/dist/modals/modals.service.js +8 -11
  155. package/dist/necord-context.creator.d.ts +1 -1
  156. package/dist/necord-context.creator.js +29 -24
  157. package/dist/necord-explorer.service.d.ts +2 -2
  158. package/dist/necord-explorer.service.js +28 -21
  159. package/dist/necord-options.interface.js +1 -2
  160. package/dist/necord.module-definition.d.ts +1 -1
  161. package/dist/necord.module-definition.js +3 -7
  162. package/dist/necord.module.d.ts +3 -3
  163. package/dist/necord.module.js +35 -38
  164. package/dist/providers/channels.provider.js +4 -7
  165. package/dist/providers/client.provider.js +6 -9
  166. package/dist/providers/guilds.provider.js +4 -7
  167. package/dist/providers/index.d.ts +8 -8
  168. package/dist/providers/index.js +8 -11
  169. package/dist/providers/rest.provider.js +4 -7
  170. package/dist/providers/shard.provider.d.ts +1 -1
  171. package/dist/providers/shard.provider.js +4 -7
  172. package/dist/providers/users.provider.js +4 -7
  173. package/dist/providers/voice.provider.js +4 -7
  174. package/dist/providers/ws.provider.js +4 -7
  175. package/dist/scopes/async.context.d.ts +1 -1
  176. package/dist/scopes/async.context.js +10 -14
  177. package/dist/scopes/index.d.ts +1 -1
  178. package/dist/scopes/index.js +1 -4
  179. package/dist/text-commands/decorators/arguments.decorator.js +5 -8
  180. package/dist/text-commands/decorators/index.d.ts +2 -2
  181. package/dist/text-commands/decorators/index.js +2 -5
  182. package/dist/text-commands/decorators/text-command.decorator.d.ts +1 -1
  183. package/dist/text-commands/decorators/text-command.decorator.js +4 -7
  184. package/dist/text-commands/index.d.ts +4 -4
  185. package/dist/text-commands/index.js +4 -7
  186. package/dist/text-commands/text-command.discovery.d.ts +1 -1
  187. package/dist/text-commands/text-command.discovery.js +2 -6
  188. package/dist/text-commands/text-commands.module.d.ts +4 -4
  189. package/dist/text-commands/text-commands.module.js +19 -22
  190. package/dist/text-commands/text-commands.service.d.ts +2 -2
  191. package/dist/text-commands/text-commands.service.js +8 -11
  192. package/package.json +41 -32
  193. package/.husky/commit-msg +0 -1
  194. package/.husky/pre-commit +0 -1
  195. package/.prettierrc +0 -8
  196. package/.release-it.json +0 -74
  197. package/CHANGELOG.md +0 -478
  198. package/coverage/clover.xml +0 -1805
  199. package/coverage/coverage-final.json +0 -113
  200. package/coverage/lcov-report/base.css +0 -224
  201. package/coverage/lcov-report/block-navigation.js +0 -87
  202. package/coverage/lcov-report/favicon.png +0 -0
  203. package/coverage/lcov-report/index.html +0 -431
  204. package/coverage/lcov-report/prettify.css +0 -1
  205. package/coverage/lcov-report/prettify.js +0 -2
  206. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  207. package/coverage/lcov-report/sorter.js +0 -210
  208. package/coverage/lcov.info +0 -3316
  209. package/eslint.config.mjs +0 -94
  210. package/jest.config.json +0 -16
  211. package/tsconfig.json +0 -27
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AutocompleteInterceptor = void 0;
4
- const tslib_1 = require("tslib");
5
- const common_1 = require("@nestjs/common");
6
- const rxjs_1 = require("rxjs");
7
- const context_1 = require("../../../context");
1
+ import { __decorate } from "tslib";
2
+ import { Injectable } from '@nestjs/common';
3
+ import { of } from 'rxjs';
4
+ import { NecordExecutionContext } from '../../../context/index.js';
8
5
  /**
9
6
  * The autocomplete interceptor.
10
7
  * @see AutocompleteContext
@@ -13,15 +10,15 @@ const context_1 = require("../../../context");
13
10
  */
14
11
  let AutocompleteInterceptor = class AutocompleteInterceptor {
15
12
  async intercept(context, next) {
16
- const necordContext = context_1.NecordExecutionContext.create(context);
13
+ const necordContext = NecordExecutionContext.create(context);
17
14
  const [interaction] = necordContext.getContext();
18
15
  const discovery = necordContext.getDiscovery();
19
16
  if (!interaction.isAutocomplete() || !discovery.isSlashCommand())
20
17
  return next.handle();
21
- return (0, rxjs_1.of)(this.transformOptions(interaction));
18
+ return of(this.transformOptions(interaction));
22
19
  }
23
20
  };
24
- exports.AutocompleteInterceptor = AutocompleteInterceptor;
25
- exports.AutocompleteInterceptor = AutocompleteInterceptor = tslib_1.__decorate([
26
- (0, common_1.Injectable)()
21
+ AutocompleteInterceptor = __decorate([
22
+ Injectable()
27
23
  ], AutocompleteInterceptor);
24
+ export { AutocompleteInterceptor };
@@ -1 +1 @@
1
- export * from './autocomplete.interceptor';
1
+ export * from './autocomplete.interceptor.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("./autocomplete.interceptor"), exports);
1
+ export * from './autocomplete.interceptor.js';
@@ -1,3 +1,3 @@
1
- export * from './slash-command.decorator';
2
- export * from './subcommand-group.decorator';
3
- export * from './subcommand.decorator';
1
+ export * from './slash-command.decorator.js';
2
+ export * from './subcommand-group.decorator.js';
3
+ export * from './subcommand.decorator.js';
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./slash-command.decorator"), exports);
5
- tslib_1.__exportStar(require("./subcommand-group.decorator"), exports);
6
- tslib_1.__exportStar(require("./subcommand.decorator"), exports);
1
+ export * from './slash-command.decorator.js';
2
+ export * from './subcommand-group.decorator.js';
3
+ export * from './subcommand.decorator.js';
@@ -1,4 +1,4 @@
1
- import { RootCommandMeta, SlashCommandDiscovery } from '../slash-command.discovery';
1
+ import { RootCommandMeta, SlashCommandDiscovery } from '../slash-command.discovery.js';
2
2
  /**
3
3
  * Decorator that marks a method as a slash command.
4
4
  * @param options The slash command options.
@@ -8,4 +8,4 @@ import { RootCommandMeta, SlashCommandDiscovery } from '../slash-command.discove
8
8
  * @url https://necord.org/interactions/slash-commands
9
9
  *
10
10
  */
11
- export declare const SlashCommand: import("@nestjs/core").ReflectableDecorator<Omit<RootCommandMeta, "type" | "options">, SlashCommandDiscovery>;
11
+ export declare const SlashCommand: import("@nestjs/core").ReflectableDecorator<Omit<RootCommandMeta, "options" | "type">, SlashCommandDiscovery>;
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SlashCommand = void 0;
4
- const discord_js_1 = require("discord.js");
5
- const core_1 = require("@nestjs/core");
6
- const slash_command_discovery_1 = require("../slash-command.discovery");
1
+ import { ApplicationCommandType } from 'discord.js';
2
+ import { Reflector } from '@nestjs/core';
3
+ import { SlashCommandDiscovery } from '../slash-command.discovery.js';
7
4
  /**
8
5
  * Decorator that marks a method as a slash command.
9
6
  * @param options The slash command options.
@@ -13,9 +10,9 @@ const slash_command_discovery_1 = require("../slash-command.discovery");
13
10
  * @url https://necord.org/interactions/slash-commands
14
11
  *
15
12
  */
16
- exports.SlashCommand = core_1.Reflector.createDecorator({
17
- transform: options => new slash_command_discovery_1.SlashCommandDiscovery({
18
- type: discord_js_1.ApplicationCommandType.ChatInput,
13
+ export const SlashCommand = Reflector.createDecorator({
14
+ transform: options => new SlashCommandDiscovery({
15
+ type: ApplicationCommandType.ChatInput,
19
16
  ...options
20
17
  })
21
18
  });
@@ -1,4 +1,4 @@
1
- import { RootCommandMeta, SlashCommandDiscovery, SubcommandGroupMeta } from '../slash-command.discovery';
1
+ import { RootCommandMeta, SlashCommandDiscovery, SubcommandGroupMeta } from '../slash-command.discovery.js';
2
2
  /**
3
3
  * Decorator that marks a method as a subcommand.
4
4
  * @param options The subcommand options.
@@ -6,7 +6,7 @@ import { RootCommandMeta, SlashCommandDiscovery, SubcommandGroupMeta } from '../
6
6
  * @see SlashCommandDiscovery
7
7
  * @url https://necord.org/interactions/slash-commands#groups
8
8
  */
9
- export declare const SubcommandGroup: import("@nestjs/core").ReflectableDecorator<Omit<import("discord.js").ApplicationCommandSubGroupData, "type" | "options">, SlashCommandDiscovery>;
9
+ export declare const SubcommandGroup: import("@nestjs/core").ReflectableDecorator<Omit<import("discord.js").ApplicationCommandSubGroupData, "options" | "type">, SlashCommandDiscovery>;
10
10
  /**
11
11
  * Factory that creates a decorator that marks a class as a slash command group.
12
12
  * @param rootOptions
@@ -15,4 +15,4 @@ export declare const SubcommandGroup: import("@nestjs/core").ReflectableDecorato
15
15
  * @see SubcommandGroup
16
16
  * @url https://necord.org/interactions/slash-commands#groups
17
17
  */
18
- export declare const createCommandGroupDecorator: (rootOptions: Omit<RootCommandMeta, "type">) => (subOptions?: Omit<SubcommandGroupMeta, "type" | "options">) => ClassDecorator;
18
+ export declare const createCommandGroupDecorator: (rootOptions: Omit<RootCommandMeta, 'type'>) => (subOptions?: Omit<SubcommandGroupMeta, 'type' | 'options'>) => ClassDecorator;
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createCommandGroupDecorator = exports.SubcommandGroup = void 0;
4
- const discord_js_1 = require("discord.js");
5
- const common_1 = require("@nestjs/common");
6
- const core_1 = require("@nestjs/core");
7
- const rxjs_1 = require("rxjs");
8
- const slash_command_discovery_1 = require("../slash-command.discovery");
9
- const slash_command_decorator_1 = require("./slash-command.decorator");
1
+ import { ApplicationCommandOptionType } from 'discord.js';
2
+ import { applyDecorators } from '@nestjs/common';
3
+ import { Reflector } from '@nestjs/core';
4
+ import { noop } from 'rxjs';
5
+ import { SlashCommandDiscovery } from '../slash-command.discovery.js';
6
+ import { SlashCommand } from './slash-command.decorator.js';
10
7
  /**
11
8
  * Decorator that marks a method as a subcommand.
12
9
  * @param options The subcommand options.
@@ -14,9 +11,9 @@ const slash_command_decorator_1 = require("./slash-command.decorator");
14
11
  * @see SlashCommandDiscovery
15
12
  * @url https://necord.org/interactions/slash-commands#groups
16
13
  */
17
- exports.SubcommandGroup = core_1.Reflector.createDecorator({
18
- transform: options => new slash_command_discovery_1.SlashCommandDiscovery({
19
- type: discord_js_1.ApplicationCommandOptionType.SubcommandGroup,
14
+ export const SubcommandGroup = Reflector.createDecorator({
15
+ transform: options => new SlashCommandDiscovery({
16
+ type: ApplicationCommandOptionType.SubcommandGroup,
20
17
  options: [],
21
18
  ...options
22
19
  })
@@ -29,11 +26,10 @@ exports.SubcommandGroup = core_1.Reflector.createDecorator({
29
26
  * @see SubcommandGroup
30
27
  * @url https://necord.org/interactions/slash-commands#groups
31
28
  */
32
- const createCommandGroupDecorator = (rootOptions) => {
33
- const rootCommand = (0, slash_command_decorator_1.SlashCommand)(rootOptions);
29
+ export const createCommandGroupDecorator = (rootOptions) => {
30
+ const rootCommand = SlashCommand(rootOptions);
34
31
  return (subOptions) => {
35
- const subCommandGroup = subOptions ? (0, exports.SubcommandGroup)(subOptions) : rxjs_1.noop;
36
- return (0, common_1.applyDecorators)(rootCommand, subCommandGroup);
32
+ const subCommandGroup = subOptions ? SubcommandGroup(subOptions) : noop;
33
+ return applyDecorators(rootCommand, subCommandGroup);
37
34
  };
38
35
  };
39
- exports.createCommandGroupDecorator = createCommandGroupDecorator;
@@ -1,4 +1,4 @@
1
- import { SlashCommandDiscovery } from '../slash-command.discovery';
1
+ import { SlashCommandDiscovery } from '../slash-command.discovery.js';
2
2
  /**
3
3
  * Decorator that marks a method as a subcommand.
4
4
  * @param options The subcommand options.
@@ -6,4 +6,4 @@ import { SlashCommandDiscovery } from '../slash-command.discovery';
6
6
  * @see SlashCommandDiscovery
7
7
  * @url https://necord.org/interactions/slash-commands#groups
8
8
  */
9
- export declare const Subcommand: import("@nestjs/core").ReflectableDecorator<Omit<import("discord.js").ApplicationCommandSubCommandData, "type" | "options" | "autocomplete">, SlashCommandDiscovery>;
9
+ export declare const Subcommand: import("@nestjs/core").ReflectableDecorator<Omit<import("discord.js").ApplicationCommandSubCommandData, "autocomplete" | "options" | "type">, SlashCommandDiscovery>;
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Subcommand = void 0;
4
- const discord_js_1 = require("discord.js");
5
- const core_1 = require("@nestjs/core");
6
- const slash_command_discovery_1 = require("../slash-command.discovery");
1
+ import { ApplicationCommandOptionType } from 'discord.js';
2
+ import { Reflector } from '@nestjs/core';
3
+ import { SlashCommandDiscovery } from '../slash-command.discovery.js';
7
4
  /**
8
5
  * Decorator that marks a method as a subcommand.
9
6
  * @param options The subcommand options.
@@ -11,9 +8,9 @@ const slash_command_discovery_1 = require("../slash-command.discovery");
11
8
  * @see SlashCommandDiscovery
12
9
  * @url https://necord.org/interactions/slash-commands#groups
13
10
  */
14
- exports.Subcommand = core_1.Reflector.createDecorator({
15
- transform: options => new slash_command_discovery_1.SlashCommandDiscovery({
16
- type: discord_js_1.ApplicationCommandOptionType.Subcommand,
11
+ export const Subcommand = Reflector.createDecorator({
12
+ transform: options => new SlashCommandDiscovery({
13
+ type: ApplicationCommandOptionType.Subcommand,
17
14
  ...options
18
15
  })
19
16
  });
@@ -1,6 +1,6 @@
1
- export * from './autocomplete';
2
- export * from './decorators';
3
- export * from './options';
4
- export * from './slash-command.discovery';
5
- export * from './slash-commands.module';
6
- export * from './slash-commands.service';
1
+ export * from './autocomplete/index.js';
2
+ export * from './decorators/index.js';
3
+ export * from './options/index.js';
4
+ export * from './slash-command.discovery.js';
5
+ export * from './slash-commands.module.js';
6
+ export * from './slash-commands.service.js';
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./autocomplete"), exports);
5
- tslib_1.__exportStar(require("./decorators"), exports);
6
- tslib_1.__exportStar(require("./options"), exports);
7
- tslib_1.__exportStar(require("./slash-command.discovery"), exports);
8
- tslib_1.__exportStar(require("./slash-commands.module"), exports);
9
- tslib_1.__exportStar(require("./slash-commands.service"), exports);
1
+ export * from './autocomplete/index.js';
2
+ export * from './decorators/index.js';
3
+ export * from './options/index.js';
4
+ export * from './slash-command.discovery.js';
5
+ export * from './slash-commands.module.js';
6
+ export * from './slash-commands.service.js';
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AttachmentOption = void 0;
4
- const discord_js_1 = require("discord.js");
5
- const option_util_1 = require("./option.util");
1
+ import { ApplicationCommandOptionType } from 'discord.js';
2
+ import { createOptionDecorator } from './option.util.js';
6
3
  /**
7
4
  * Param decorator that marks a method as an attachment option.
8
5
  * @param options The attachment options.
9
6
  * @returns The decorated method.
10
7
  * @url https://necord.org/interactions/slash-commands#options
11
8
  */
12
- exports.AttachmentOption = (0, option_util_1.createOptionDecorator)(discord_js_1.ApplicationCommandOptionType.Attachment, 'getAttachment');
9
+ export const AttachmentOption = createOptionDecorator(ApplicationCommandOptionType.Attachment, 'getAttachment');
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BooleanOption = void 0;
4
- const discord_js_1 = require("discord.js");
5
- const option_util_1 = require("./option.util");
1
+ import { ApplicationCommandOptionType } from 'discord.js';
2
+ import { createOptionDecorator } from './option.util.js';
6
3
  /**
7
4
  * Param decorator that marks a method as a boolean option.
8
5
  * @param options The boolean options.
9
6
  * @returns The decorated method.
10
7
  * @url https://necord.org/interactions/slash-commands#options
11
8
  */
12
- exports.BooleanOption = (0, option_util_1.createOptionDecorator)(discord_js_1.ApplicationCommandOptionType.Boolean, 'getBoolean');
9
+ export const BooleanOption = createOptionDecorator(ApplicationCommandOptionType.Boolean, 'getBoolean');
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ChannelOption = void 0;
4
- const discord_js_1 = require("discord.js");
5
- const option_util_1 = require("./option.util");
1
+ import { ApplicationCommandOptionType } from 'discord.js';
2
+ import { createOptionDecorator } from './option.util.js';
6
3
  /**
7
4
  * Param decorator that marks a method as a channel option.
8
5
  * @param options The channel options.
9
6
  * @returns The decorated method.
10
7
  * @url https://necord.org/interactions/slash-commands#options
11
8
  */
12
- exports.ChannelOption = (0, option_util_1.createOptionDecorator)(discord_js_1.ApplicationCommandOptionType.Channel, 'getChannel');
9
+ export const ChannelOption = createOptionDecorator(ApplicationCommandOptionType.Channel, 'getChannel');
@@ -1,12 +1,12 @@
1
- export * from './attachment-option.decorator';
2
- export * from './boolean-option.decorator';
3
- export * from './channel-option.decorator';
4
- export * from './integer-option.decorator';
5
- export * from './member-option.decorator';
6
- export * from './mentionable-option.decorator';
7
- export * from './number-option.decorator';
8
- export * from './option.util';
9
- export * from './options.decorator';
10
- export * from './role-option.decorator';
11
- export * from './string-option.decorator';
12
- export * from './user-option.decorator';
1
+ export * from './attachment-option.decorator.js';
2
+ export * from './boolean-option.decorator.js';
3
+ export * from './channel-option.decorator.js';
4
+ export * from './integer-option.decorator.js';
5
+ export * from './member-option.decorator.js';
6
+ export * from './mentionable-option.decorator.js';
7
+ export * from './number-option.decorator.js';
8
+ export * from './option.util.js';
9
+ export * from './options.decorator.js';
10
+ export * from './role-option.decorator.js';
11
+ export * from './string-option.decorator.js';
12
+ export * from './user-option.decorator.js';
@@ -1,15 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./attachment-option.decorator"), exports);
5
- tslib_1.__exportStar(require("./boolean-option.decorator"), exports);
6
- tslib_1.__exportStar(require("./channel-option.decorator"), exports);
7
- tslib_1.__exportStar(require("./integer-option.decorator"), exports);
8
- tslib_1.__exportStar(require("./member-option.decorator"), exports);
9
- tslib_1.__exportStar(require("./mentionable-option.decorator"), exports);
10
- tslib_1.__exportStar(require("./number-option.decorator"), exports);
11
- tslib_1.__exportStar(require("./option.util"), exports);
12
- tslib_1.__exportStar(require("./options.decorator"), exports);
13
- tslib_1.__exportStar(require("./role-option.decorator"), exports);
14
- tslib_1.__exportStar(require("./string-option.decorator"), exports);
15
- tslib_1.__exportStar(require("./user-option.decorator"), exports);
1
+ export * from './attachment-option.decorator.js';
2
+ export * from './boolean-option.decorator.js';
3
+ export * from './channel-option.decorator.js';
4
+ export * from './integer-option.decorator.js';
5
+ export * from './member-option.decorator.js';
6
+ export * from './mentionable-option.decorator.js';
7
+ export * from './number-option.decorator.js';
8
+ export * from './option.util.js';
9
+ export * from './options.decorator.js';
10
+ export * from './role-option.decorator.js';
11
+ export * from './string-option.decorator.js';
12
+ export * from './user-option.decorator.js';
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IntegerOption = void 0;
4
- const discord_js_1 = require("discord.js");
5
- const option_util_1 = require("./option.util");
1
+ import { ApplicationCommandOptionType } from 'discord.js';
2
+ import { createOptionDecorator } from './option.util.js';
6
3
  /**
7
4
  * Param decorator that marks a method as an integer option.
8
5
  * @param options The integer options.
9
6
  * @returns The decorated method.
10
7
  * @url https://necord.org/interactions/slash-commands#options
11
8
  */
12
- exports.IntegerOption = (0, option_util_1.createOptionDecorator)(discord_js_1.ApplicationCommandOptionType.Integer, 'getInteger');
9
+ export const IntegerOption = createOptionDecorator(ApplicationCommandOptionType.Integer, 'getInteger');
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MemberOption = void 0;
4
- const discord_js_1 = require("discord.js");
5
- const option_util_1 = require("./option.util");
1
+ import { ApplicationCommandOptionType } from 'discord.js';
2
+ import { createOptionDecorator } from './option.util.js';
6
3
  /**
7
4
  * Param decorator that marks a method as a member option.
8
5
  * @param options The member options.
9
6
  * @returns The decorated method.
10
7
  * @url https://necord.org/interactions/slash-commands#options
11
8
  */
12
- exports.MemberOption = (0, option_util_1.createOptionDecorator)(discord_js_1.ApplicationCommandOptionType.User, 'getMember');
9
+ export const MemberOption = createOptionDecorator(ApplicationCommandOptionType.User, 'getMember');
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MentionableOption = void 0;
4
- const discord_js_1 = require("discord.js");
5
- const option_util_1 = require("./option.util");
1
+ import { ApplicationCommandOptionType } from 'discord.js';
2
+ import { createOptionDecorator } from './option.util.js';
6
3
  /**
7
4
  * Param decorator that marks a method as a mentionable option.
8
5
  * @param options The mentionable options.
9
6
  * @returns The decorated method.
10
7
  * @url https://necord.org/interactions/slash-commands#options
11
8
  */
12
- exports.MentionableOption = (0, option_util_1.createOptionDecorator)(discord_js_1.ApplicationCommandOptionType.Mentionable, 'getMentionable');
9
+ export const MentionableOption = createOptionDecorator(ApplicationCommandOptionType.Mentionable, 'getMentionable');
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NumberOption = void 0;
4
- const discord_js_1 = require("discord.js");
5
- const option_util_1 = require("./option.util");
1
+ import { ApplicationCommandOptionType } from 'discord.js';
2
+ import { createOptionDecorator } from './option.util.js';
6
3
  /**
7
4
  * Param decorator that marks a method as a number option.
8
5
  * @param options The number options.
9
6
  * @returns The decorated method.
10
7
  * @url https://necord.org/interactions/slash-commands#options
11
8
  */
12
- exports.NumberOption = (0, option_util_1.createOptionDecorator)(discord_js_1.ApplicationCommandOptionType.Number, 'getNumber');
9
+ export const NumberOption = createOptionDecorator(ApplicationCommandOptionType.Number, 'getNumber');
@@ -1,5 +1,5 @@
1
1
  import { APIApplicationCommandOptionBase } from 'discord-api-types/v10';
2
2
  import { ApplicationCommandOptionType } from 'discord.js';
3
- import { OptionMeta } from '../slash-command.discovery';
3
+ import { OptionMeta } from '../slash-command.discovery.js';
4
4
  export declare const OPTIONS_METADATA = "necord:options_meta";
5
- export declare function createOptionDecorator<T extends APIApplicationCommandOptionBase<any>>(type: ApplicationCommandOptionType, resolver: OptionMeta['resolver']): (data: Omit<T, "type">) => PropertyDecorator;
5
+ export declare function createOptionDecorator<T extends APIApplicationCommandOptionBase<any>>(type: ApplicationCommandOptionType, resolver: OptionMeta['resolver']): (data: Omit<T, 'type'>) => PropertyDecorator;
@@ -1,21 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OPTIONS_METADATA = void 0;
4
- exports.createOptionDecorator = createOptionDecorator;
5
- exports.OPTIONS_METADATA = 'necord:options_meta';
6
- function createOptionDecorator(type, resolver) {
1
+ export const OPTIONS_METADATA = 'necord:options_meta';
2
+ export function createOptionDecorator(type, resolver) {
7
3
  return (data) => {
8
4
  return (target, propertyKey) => {
9
- let metadata = Reflect.getOwnMetadata(exports.OPTIONS_METADATA, target);
10
- if (!metadata) {
5
+ let metadata = Reflect.getOwnMetadata(OPTIONS_METADATA, target);
6
+ if (!metadata)
11
7
  metadata = {};
12
- }
13
8
  metadata[String(propertyKey)] = {
14
9
  ...data,
15
10
  type,
16
11
  resolver
17
12
  };
18
- Reflect.defineMetadata(exports.OPTIONS_METADATA, metadata, target);
13
+ Reflect.defineMetadata(OPTIONS_METADATA, metadata, target);
19
14
  };
20
15
  };
21
16
  }
@@ -1,36 +1,44 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Opts = exports.Options = void 0;
4
- const common_1 = require("@nestjs/common");
5
- const context_1 = require("../../../context");
6
- const option_util_1 = require("./option.util");
1
+ import { createParamDecorator } from '@nestjs/common';
2
+ import { NecordExecutionContext } from '../../../context/index.js';
3
+ import { OPTIONS_METADATA } from './option.util.js';
7
4
  /**
8
5
  * Options decorator that mark arguments as options.
9
6
  * This decorator is used to retrieve the options from a slash command.
10
7
  * @returns The decorated argument.
11
8
  * @url https://necord.org/interactions/slash-commands#options
12
9
  */
13
- exports.Options = (0, common_1.createParamDecorator)((_, context) => {
14
- const necordContext = context_1.NecordExecutionContext.create(context);
10
+ export const Options = createParamDecorator((_, context) => {
11
+ const necordContext = NecordExecutionContext.create(context);
15
12
  const [interaction] = necordContext.getContext();
16
13
  const discovery = necordContext.getDiscovery();
17
- if (!discovery.isSlashCommand())
14
+ if (!interaction || !discovery.isSlashCommand())
18
15
  return null;
19
16
  return Object.entries(discovery.getRawOptions()).reduce((acc, [parameter, option]) => {
20
- acc[parameter] = interaction.options[option.resolver].call(interaction.options, option.name, !!option.required);
17
+ const resolver = option.resolver;
18
+ if (!resolver) {
19
+ return acc;
20
+ }
21
+ acc[parameter] = interaction.options[resolver].call(interaction.options, option.name, !!option.required);
21
22
  return acc;
22
23
  }, {});
23
24
  }, [
24
25
  (target, propertyKey, parameterIndex) => {
26
+ if (propertyKey === undefined) {
27
+ return;
28
+ }
25
29
  const paramTypes = Reflect.getMetadata('design:paramtypes', target, propertyKey);
26
- let { prototype } = paramTypes[parameterIndex];
30
+ const paramType = paramTypes?.[parameterIndex];
31
+ if (!paramType) {
32
+ return;
33
+ }
34
+ let { prototype } = paramType;
27
35
  const options = {};
28
36
  do {
29
- const metadata = Reflect.getOwnMetadata(option_util_1.OPTIONS_METADATA, prototype);
37
+ const metadata = Reflect.getOwnMetadata(OPTIONS_METADATA, prototype);
30
38
  Object.assign(options, metadata);
31
39
  } while ((prototype = Reflect.getPrototypeOf(prototype)) &&
32
40
  prototype !== Object.prototype);
33
- Reflect.defineMetadata(option_util_1.OPTIONS_METADATA, options, target[propertyKey]);
41
+ Reflect.defineMetadata(OPTIONS_METADATA, options, target[propertyKey]);
34
42
  }
35
43
  ]);
36
- exports.Opts = exports.Options;
44
+ export const Opts = Options;
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RoleOption = void 0;
4
- const discord_js_1 = require("discord.js");
5
- const option_util_1 = require("./option.util");
1
+ import { ApplicationCommandOptionType } from 'discord.js';
2
+ import { createOptionDecorator } from './option.util.js';
6
3
  /**
7
4
  * Param decorator that marks a method as a role option.
8
5
  * @param options The role options.
9
6
  * @returns The decorated method.
10
7
  * @url https://necord.org/interactions/slash-commands#options
11
8
  */
12
- exports.RoleOption = (0, option_util_1.createOptionDecorator)(discord_js_1.ApplicationCommandOptionType.Role, 'getRole');
9
+ export const RoleOption = createOptionDecorator(ApplicationCommandOptionType.Role, 'getRole');
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StringOption = void 0;
4
- const discord_js_1 = require("discord.js");
5
- const option_util_1 = require("./option.util");
1
+ import { ApplicationCommandOptionType } from 'discord.js';
2
+ import { createOptionDecorator } from './option.util.js';
6
3
  /**
7
4
  * Param decorator that marks a method as a string option.
8
5
  * @param options The string options.
9
6
  * @returns The decorated method.
10
7
  * @url https://necord.org/interactions/slash-commands#options
11
8
  */
12
- exports.StringOption = (0, option_util_1.createOptionDecorator)(discord_js_1.ApplicationCommandOptionType.String, 'getString');
9
+ export const StringOption = createOptionDecorator(ApplicationCommandOptionType.String, 'getString');
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UserOption = void 0;
4
- const discord_js_1 = require("discord.js");
5
- const option_util_1 = require("./option.util");
1
+ import { ApplicationCommandOptionType } from 'discord.js';
2
+ import { createOptionDecorator } from './option.util.js';
6
3
  /**
7
4
  * Param decorator that marks a method as a user option.
8
5
  * @param options The user options.
9
6
  * @returns The decorated method.
10
7
  * @url https://necord.org/interactions/slash-commands#options
11
8
  */
12
- exports.UserOption = (0, option_util_1.createOptionDecorator)(discord_js_1.ApplicationCommandOptionType.User, 'getUser');
9
+ export const UserOption = createOptionDecorator(ApplicationCommandOptionType.User, 'getUser');