@pikokr/command.ts 3.2.4-dev.434c22e → 3.2.4-dev.535de3c

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 (86) hide show
  1. package/dist/applicationCommand/AppCommand.d.ts +18 -0
  2. package/dist/{slashCommand/SlashCommand.js → applicationCommand/AppCommand.js} +7 -7
  3. package/dist/applicationCommand/AppCommand.js.map +1 -0
  4. package/dist/applicationCommand/decorator.d.ts +10 -0
  5. package/dist/{slashCommand → applicationCommand}/decorator.js +9 -8
  6. package/dist/applicationCommand/decorator.js.map +1 -0
  7. package/dist/applicationCommand/index.d.ts +2 -0
  8. package/dist/{slashCommand → applicationCommand}/index.js +1 -1
  9. package/dist/applicationCommand/index.js.map +1 -0
  10. package/dist/builtinModules/CommandHandler.d.ts +4 -1
  11. package/dist/builtinModules/CommandHandler.js +107 -15
  12. package/dist/builtinModules/CommandHandler.js.map +1 -1
  13. package/dist/command/Command.d.ts +2 -2
  14. package/dist/command/decorator.d.ts +1 -0
  15. package/dist/command/decorator.js +2 -1
  16. package/dist/command/decorator.js.map +1 -1
  17. package/dist/command/utils.d.ts +2 -2
  18. package/dist/command/utils.js +6 -6
  19. package/dist/command/utils.js.map +1 -1
  20. package/dist/constants.d.ts +3 -2
  21. package/dist/constants.js +4 -3
  22. package/dist/constants.js.map +1 -1
  23. package/dist/error/ArgumentConverterNotFound.d.ts +1 -1
  24. package/dist/error/CommandCheckFailed.d.ts +6 -6
  25. package/dist/error/CommandCheckFailed.js +3 -3
  26. package/dist/error/CommandCheckFailed.js.map +1 -1
  27. package/dist/error/checks/SlashCommandGlobalCheckError.d.ts +5 -0
  28. package/dist/error/checks/SlashCommandGlobalCheckError.js +11 -0
  29. package/dist/error/checks/SlashCommandGlobalCheckError.js.map +1 -0
  30. package/dist/index.d.ts +2 -1
  31. package/dist/index.js +2 -1
  32. package/dist/index.js.map +1 -1
  33. package/dist/messageComponents/base.d.ts +10 -0
  34. package/dist/messageComponents/base.js +15 -0
  35. package/dist/messageComponents/base.js.map +1 -0
  36. package/dist/messageComponents/button.d.ts +5 -0
  37. package/dist/messageComponents/button.js +28 -0
  38. package/dist/messageComponents/button.js.map +1 -0
  39. package/dist/messageComponents/index.d.ts +2 -0
  40. package/dist/messageComponents/index.js +15 -0
  41. package/dist/messageComponents/index.js.map +1 -0
  42. package/dist/messageComponents/selectMenu.d.ts +5 -0
  43. package/dist/messageComponents/selectMenu.js +28 -0
  44. package/dist/messageComponents/selectMenu.js.map +1 -0
  45. package/dist/structures/CommandClient.d.ts +7 -3
  46. package/dist/structures/CommandClient.js +6 -7
  47. package/dist/structures/CommandClient.js.map +1 -1
  48. package/dist/structures/Module.d.ts +4 -2
  49. package/dist/structures/Module.js +5 -2
  50. package/dist/structures/Module.js.map +1 -1
  51. package/dist/structures/Registry.d.ts +4 -2
  52. package/dist/structures/Registry.js +16 -13
  53. package/dist/structures/Registry.js.map +1 -1
  54. package/dist/typings.d.ts +14 -2
  55. package/package.json +1 -3
  56. package/src/applicationCommand/AppCommand.ts +28 -0
  57. package/src/{slashCommand → applicationCommand}/decorator.ts +10 -10
  58. package/src/applicationCommand/index.ts +2 -0
  59. package/src/builtinModules/CommandHandler.ts +123 -18
  60. package/src/command/Command.ts +2 -2
  61. package/src/command/decorator.ts +2 -1
  62. package/src/command/utils.ts +9 -9
  63. package/src/constants.ts +4 -2
  64. package/src/error/ArgumentConverterNotFound.ts +1 -1
  65. package/src/error/CommandCheckFailed.ts +4 -4
  66. package/src/error/checks/SlashCommandGlobalCheckError.ts +7 -0
  67. package/src/index.ts +2 -1
  68. package/src/messageComponents/base.ts +12 -0
  69. package/src/messageComponents/button.ts +26 -0
  70. package/src/messageComponents/index.ts +2 -0
  71. package/src/messageComponents/selectMenu.ts +26 -0
  72. package/src/structures/CommandClient.ts +14 -8
  73. package/src/structures/Module.ts +9 -4
  74. package/src/structures/Registry.ts +21 -15
  75. package/src/typings.ts +14 -2
  76. package/test/index.ts +2 -2
  77. package/test/modules/dev.ts +9 -5
  78. package/test/modules/test.ts +88 -15
  79. package/dist/slashCommand/SlashCommand.d.ts +0 -19
  80. package/dist/slashCommand/SlashCommand.js.map +0 -1
  81. package/dist/slashCommand/decorator.d.ts +0 -10
  82. package/dist/slashCommand/decorator.js.map +0 -1
  83. package/dist/slashCommand/index.d.ts +0 -2
  84. package/dist/slashCommand/index.js.map +0 -1
  85. package/src/slashCommand/SlashCommand.ts +0 -29
  86. package/src/slashCommand/index.ts +0 -2
@@ -0,0 +1,10 @@
1
+ import { MessageComponentInteraction, MessageComponentType } from 'discord.js';
2
+ import { Module } from '../structures';
3
+ export declare type MessageComponentExecutor = (i: MessageComponentInteraction) => void | Promise<void>;
4
+ export declare class MessageComponentHandler {
5
+ componentId: string;
6
+ componentType: Exclude<MessageComponentType, 'ACTION_ROW'>;
7
+ execute: MessageComponentExecutor;
8
+ constructor(componentId: string, componentType: Exclude<MessageComponentType, 'ACTION_ROW'>, execute: MessageComponentExecutor);
9
+ run(module: Module, i: MessageComponentInteraction): void | Promise<void>;
10
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MessageComponentHandler = void 0;
4
+ class MessageComponentHandler {
5
+ constructor(componentId, componentType, execute) {
6
+ this.componentId = componentId;
7
+ this.componentType = componentType;
8
+ this.execute = execute;
9
+ }
10
+ run(module, i) {
11
+ return this.execute.apply(module, [i]);
12
+ }
13
+ }
14
+ exports.MessageComponentHandler = MessageComponentHandler;
15
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/messageComponents/base.ts"],"names":[],"mappings":";;;AAKA,MAAa,uBAAuB;IAClC,YAAmB,WAAmB,EAAS,aAA0D,EAAS,OAAiC;QAAhI,gBAAW,GAAX,WAAW,CAAQ;QAAS,kBAAa,GAAb,aAAa,CAA6C;QAAS,YAAO,GAAP,OAAO,CAA0B;IAAG,CAAC;IAEvJ,GAAG,CAAC,MAAc,EAAE,CAA8B;QAChD,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;IACxC,CAAC;CACF;AAND,0DAMC"}
@@ -0,0 +1,5 @@
1
+ import { MessageComponentExecutor, MessageComponentHandler } from './base';
2
+ export declare class ButtonInteractionHandler extends MessageComponentHandler {
3
+ constructor(id: string, execute: MessageComponentExecutor);
4
+ }
5
+ export declare const messageButton: (id: string) => MethodDecorator;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.messageButton = exports.ButtonInteractionHandler = void 0;
4
+ const base_1 = require("./base");
5
+ const utils_1 = require("../utils");
6
+ const constants_1 = require("../constants");
7
+ class ButtonInteractionHandler extends base_1.MessageComponentHandler {
8
+ constructor(id, execute) {
9
+ super(id, 'BUTTON', execute);
10
+ }
11
+ }
12
+ exports.ButtonInteractionHandler = ButtonInteractionHandler;
13
+ const messageButton = (id) => {
14
+ return (target, propertyKey) => {
15
+ utils_1.checkTarget(target);
16
+ const handler = new ButtonInteractionHandler(id, Reflect.get(target, propertyKey));
17
+ let properties = Reflect.getMetadata(constants_1.KMessageComponentHandlers, target);
18
+ if (properties) {
19
+ properties.push(handler);
20
+ }
21
+ else {
22
+ properties = [handler];
23
+ Reflect.defineMetadata(constants_1.KMessageComponentHandlers, properties, target);
24
+ }
25
+ };
26
+ };
27
+ exports.messageButton = messageButton;
28
+ //# sourceMappingURL=button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/messageComponents/button.ts"],"names":[],"mappings":";;;AAAA,iCAA0E;AAC1E,oCAAsC;AACtC,4CAAwD;AAExD,MAAa,wBAAyB,SAAQ,8BAAuB;IACnE,YAAY,EAAU,EAAE,OAAiC;QACvD,KAAK,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;IAC9B,CAAC;CACF;AAJD,4DAIC;AAEM,MAAM,aAAa,GAAG,CAAC,EAAU,EAAmB,EAAE;IAC3D,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE;QAC7B,mBAAW,CAAC,MAAM,CAAC,CAAA;QAEnB,MAAM,OAAO,GAAG,IAAI,wBAAwB,CAAC,EAAE,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAA;QAElF,IAAI,UAAU,GAA8B,OAAO,CAAC,WAAW,CAAC,qCAAyB,EAAE,MAAM,CAAC,CAAA;QAElG,IAAI,UAAU,EAAE;YACd,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;SACzB;aAAM;YACL,UAAU,GAAG,CAAC,OAAO,CAAC,CAAA;YACtB,OAAO,CAAC,cAAc,CAAC,qCAAyB,EAAE,UAAU,EAAE,MAAM,CAAC,CAAA;SACtE;IACH,CAAC,CAAA;AACH,CAAC,CAAA;AAfY,QAAA,aAAa,iBAezB"}
@@ -0,0 +1,2 @@
1
+ export * from './button';
2
+ export * from './selectMenu';
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./button"), exports);
14
+ __exportStar(require("./selectMenu"), exports);
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/messageComponents/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAwB;AACxB,+CAA4B"}
@@ -0,0 +1,5 @@
1
+ import { MessageComponentExecutor, MessageComponentHandler } from './base';
2
+ export declare class SelectMenuInteractionHandler extends MessageComponentHandler {
3
+ constructor(id: string, execute: MessageComponentExecutor);
4
+ }
5
+ export declare const messageSelectMenu: (id: string) => MethodDecorator;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.messageSelectMenu = exports.SelectMenuInteractionHandler = void 0;
4
+ const base_1 = require("./base");
5
+ const utils_1 = require("../utils");
6
+ const constants_1 = require("../constants");
7
+ class SelectMenuInteractionHandler extends base_1.MessageComponentHandler {
8
+ constructor(id, execute) {
9
+ super(id, 'SELECT_MENU', execute);
10
+ }
11
+ }
12
+ exports.SelectMenuInteractionHandler = SelectMenuInteractionHandler;
13
+ const messageSelectMenu = (id) => {
14
+ return (target, propertyKey) => {
15
+ utils_1.checkTarget(target);
16
+ const handler = new SelectMenuInteractionHandler(id, Reflect.get(target, propertyKey));
17
+ let properties = Reflect.getMetadata(constants_1.KMessageComponentHandlers, target);
18
+ if (properties) {
19
+ properties.push(handler);
20
+ }
21
+ else {
22
+ properties = [handler];
23
+ Reflect.defineMetadata(constants_1.KMessageComponentHandlers, properties, target);
24
+ }
25
+ };
26
+ };
27
+ exports.messageSelectMenu = messageSelectMenu;
28
+ //# sourceMappingURL=selectMenu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectMenu.js","sourceRoot":"","sources":["../../src/messageComponents/selectMenu.ts"],"names":[],"mappings":";;;AAAA,iCAA0E;AAC1E,oCAAsC;AACtC,4CAAwD;AAExD,MAAa,4BAA6B,SAAQ,8BAAuB;IACvE,YAAY,EAAU,EAAE,OAAiC;QACvD,KAAK,CAAC,EAAE,EAAE,aAAa,EAAE,OAAO,CAAC,CAAA;IACnC,CAAC;CACF;AAJD,oEAIC;AAEM,MAAM,iBAAiB,GAAG,CAAC,EAAU,EAAmB,EAAE;IAC/D,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE;QAC7B,mBAAW,CAAC,MAAM,CAAC,CAAA;QAEnB,MAAM,OAAO,GAAG,IAAI,4BAA4B,CAAC,EAAE,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAA;QAEtF,IAAI,UAAU,GAA8B,OAAO,CAAC,WAAW,CAAC,qCAAyB,EAAE,MAAM,CAAC,CAAA;QAElG,IAAI,UAAU,EAAE;YACd,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;SACzB;aAAM;YACL,UAAU,GAAG,CAAC,OAAO,CAAC,CAAA;YACtB,OAAO,CAAC,cAAc,CAAC,qCAAyB,EAAE,UAAU,EAAE,MAAM,CAAC,CAAA;SACtE;IACH,CAAC,CAAA;AACH,CAAC,CAAA;AAfY,QAAA,iBAAiB,qBAe7B"}
@@ -1,7 +1,6 @@
1
1
  import { Registry } from './Registry';
2
- import { Client, Message, Snowflake } from 'discord.js';
2
+ import { Client, CommandInteraction, Interaction, Message, Snowflake } from 'discord.js';
3
3
  import { CoolDownAdapter } from '../command';
4
- import { REST } from '@discordjs/rest';
5
4
  import { Logger } from 'tslog';
6
5
  export interface CommandOptions {
7
6
  prefix: string | ((msg: any) => string | Promise<string | string[]> | string[]) | string[];
@@ -9,18 +8,24 @@ export interface CommandOptions {
9
8
  globalAliases: (cmd: string, msg: Message) => string[] | Promise<string[]>;
10
9
  }
11
10
  export interface SlashCommandOptions {
11
+ check: (i: CommandInteraction) => boolean | Promise<boolean>;
12
+ }
13
+ export interface ApplicationCommandOptions {
12
14
  guild?: Snowflake | Snowflake[];
13
15
  autoSync: boolean;
16
+ beforeRunCheck: (i: Interaction) => void | Promise<void>;
14
17
  }
15
18
  export interface CommandClientOptions {
16
19
  command: CommandOptions;
17
20
  owners: 'auto' | Snowflake[];
18
21
  slashCommands: SlashCommandOptions;
22
+ applicationCommands: ApplicationCommandOptions;
19
23
  }
20
24
  export interface CommandClientOptionsParam {
21
25
  command: Partial<CommandOptions>;
22
26
  owners: 'auto' | string[];
23
27
  slashCommands: Partial<SlashCommandOptions>;
28
+ applicationCommands: Partial<ApplicationCommandOptions>;
24
29
  }
25
30
  export declare class CommandClient {
26
31
  options: CommandClientOptions;
@@ -28,7 +33,6 @@ export declare class CommandClient {
28
33
  registry: Registry;
29
34
  client: Client;
30
35
  coolDownAdapter: CoolDownAdapter;
31
- rest: REST;
32
36
  logger: Logger;
33
37
  private _isReady;
34
38
  private fetchOwners;
@@ -29,16 +29,12 @@ const Registry_1 = require("./Registry");
29
29
  const discord_js_1 = require("discord.js");
30
30
  const builtinModules_1 = require("../builtinModules");
31
31
  const command_1 = require("../command");
32
- const rest_1 = require("@discordjs/rest");
33
32
  const tslog_1 = require("tslog");
34
33
  class CommandClient {
35
34
  constructor(_a) {
36
35
  var { client, coolDownAdapter, logger } = _a, options = __rest(_a, ["client", "coolDownAdapter", "logger"]);
37
36
  this.owners = [];
38
37
  this.registry = new Registry_1.Registry(this);
39
- this.rest = new rest_1.REST({
40
- version: '9',
41
- });
42
38
  this._isReady = false;
43
39
  this.client = client;
44
40
  this.coolDownAdapter = coolDownAdapter || new command_1.DefaultCoolDownAdapter();
@@ -50,7 +46,11 @@ class CommandClient {
50
46
  },
51
47
  owners: 'auto',
52
48
  slashCommands: {
53
- autoSync: true,
49
+ check: () => true,
50
+ },
51
+ applicationCommands: {
52
+ autoSync: false,
53
+ beforeRunCheck: () => { },
54
54
  },
55
55
  }, options);
56
56
  this.logger = logger !== null && logger !== void 0 ? logger : new tslog_1.Logger({ name: 'Command.TS' });
@@ -79,13 +79,12 @@ class CommandClient {
79
79
  return __awaiter(this, void 0, void 0, function* () {
80
80
  if (this._isReady)
81
81
  return;
82
- this.rest.setToken(this.client.token);
83
82
  this._isReady = true;
84
83
  if (this.options.owners === 'auto') {
85
84
  const owners = yield this.fetchOwners();
86
85
  this.owners.push(...owners);
87
86
  }
88
- if (this.options.slashCommands.autoSync) {
87
+ if (this.options.applicationCommands.autoSync) {
89
88
  yield this.registry.syncCommands();
90
89
  }
91
90
  });
@@ -1 +1 @@
1
- {"version":3,"file":"CommandClient.js","sourceRoot":"","sources":["../../src/structures/CommandClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsB;AACtB,yCAAqC;AACrC,2CAA6D;AAC7D,sDAA2G;AAC3G,wCAAoE;AACpE,0CAAsC;AACtC,iCAA8B;AAyB9B,MAAa,aAAa;IAkCxB,YAAY,EAA4J;YAA5J,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,OAA2H,EAAtH,OAAO,cAA7C,uCAA+C,CAAF;QAhCzD,WAAM,GAAa,EAAE,CAAA;QACrB,aAAQ,GAAG,IAAI,mBAAQ,CAAC,IAAI,CAAC,CAAA;QAG7B,SAAI,GAAG,IAAI,WAAI,CAAC;YACd,OAAO,EAAE,GAAG;SACb,CAAC,CAAA;QAGM,aAAQ,GAAG,KAAK,CAAA;QAwBtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,eAAe,GAAG,eAAe,IAAI,IAAI,gCAAsB,EAAE,CAAA;QACtE,IAAI,CAAC,OAAO,GAAG,gBAAC,CAAC,KAAK,CACpB;YACE,OAAO,EAAE;gBACP,MAAM,EAAE,GAAG;gBACX,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI;gBACjB,aAAa,EAAE,GAAG,EAAE,CAAC,EAAE;aACxB;YACD,MAAM,EAAE,MAAM;YACd,aAAa,EAAE;gBACb,QAAQ,EAAE,IAAI;aACf;SACF,EACD,OAAO,CACR,CAAA;QAED,IAAI,CAAC,MAAM,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,IAAI,cAAM,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAA;QAE1D,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,MAAM,EAAE;YAClC,IAAI,CA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,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAA;aAC5B;YACD,IAAI,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,QAAQ,EAAE;gBAC7C,MAAM,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAA;aACnC;QACH,CAAC;KAAA;CAmCF;AA/DD,sCA+DC"}
@@ -1,8 +1,9 @@
1
1
  import type { Command } from '../command';
2
2
  import { Listener } from '../listener';
3
3
  import { ArgumentConverter, SlashArgumentConverter } from '../command';
4
- import { SlashCommand } from '../slashCommand';
4
+ import { AppCommand } from '../applicationCommand';
5
5
  import { CommandClient } from './CommandClient';
6
+ import { MessageComponentHandler } from '../messageComponents/base';
6
7
  export declare abstract class Module {
7
8
  commandClient: CommandClient;
8
9
  get logger(): import("tslog").Logger;
@@ -10,7 +11,8 @@ export declare abstract class Module {
10
11
  get listeners(): Listener[];
11
12
  get argumentConverters(): ArgumentConverter[];
12
13
  get slashArgumentConverters(): SlashArgumentConverter[];
13
- get slashCommands(): SlashCommand[];
14
+ get applicationCommands(): AppCommand[];
15
+ get messageComponentHandlers(): MessageComponentHandler[];
14
16
  get path(): string | undefined;
15
17
  load(): void;
16
18
  unload(): void;
@@ -20,8 +20,11 @@ class Module {
20
20
  get slashArgumentConverters() {
21
21
  return Reflect.getMetadata(constants_1.KSlashArgumentConverters, this) || [];
22
22
  }
23
- get slashCommands() {
24
- return Reflect.getMetadata(constants_1.KSlashCommands, this) || [];
23
+ get applicationCommands() {
24
+ return Reflect.getMetadata(constants_1.KApplicationCommands, this) || [];
25
+ }
26
+ get messageComponentHandlers() {
27
+ return Reflect.getMetadata(constants_1.KMessageComponentHandlers, this) || [];
25
28
  }
26
29
  get path() {
27
30
  return Reflect.getMetadata(constants_1.KModulePath, this);
@@ -1 +1 @@
1
- {"version":3,"file":"Module.js","sourceRoot":"","sources":["../../src/structures/Module.ts"],"names":[],"mappings":";;;AAAA,4CAAgI;AAOhI,MAAsB,M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W,CAAC,qBAAS,EAAE,IAAI,CAAC,IAAI,EAAE,CAAA;IACnD,CAAC;IAED,IAAI,SAAS;QACX,OAAO,OAAO,CAAC,WAAW,CAAC,sBAAU,EAAE,IAAI,CAAC,IAAI,EAAE,CAAA;IACpD,CAAC;IAED,IAAI,kBAAkB;QACpB,OAAO,OAAO,CAAC,WAAW,CAAC,+BAAmB,EAAE,IAAI,CAAC,IAAI,EAAE,CAAA;IAC7D,CAAC;IAED,IAAI,uBAAuB;QACzB,OAAO,OAAO,CAAC,WAAW,CAAC,oCAAwB,EAAE,IAAI,CAAC,IAAI,EAAE,CAAA;IAClE,CAAC;IAED,IAAI,mBAAmB;QACrB,OAAO,OAAO,CAAC,WAAW,CAAC,gCAAoB,EAAE,IAAI,CAAC,IAAI,EAAE,CAAA;IAC9D,CAAC;IAED,IAAI,wBAAwB;QAC1B,OAAO,OAAO,CAAC,WAAW,CAAC,qCAAyB,EAAE,IAAI,CAAC,IAAI,EAAE,CAAA;IACnE,CAAC;IAED,IAAI,IAAI;QACN,OAAO,OAAO,CAAC,WAAW,CAAC,uBAAW,EAAE,IAAI,CAAC,CAAA;IAC/C,CAAC;IAED,IAAI,KAAI,CAAC;IACT,MAAM,KAAI,CAAC;IACX,YAAY,KAAI,CAAC;IACjB,WAAW,KAAI,CAAC;CACjB;AAzCD,wBAyCC"}
@@ -3,7 +3,8 @@ import { Module } from './Module';
3
3
  import { Command, SlashArgumentConverter } from '../command';
4
4
  import { Collection } from 'discord.js';
5
5
  import { ArgumentConverter } from '../command';
6
- import { SlashCommand } from '../slashCommand';
6
+ import { AppCommand } from '../applicationCommand';
7
+ import { MessageComponentHandler } from '../messageComponents/base';
7
8
  export declare class Registry {
8
9
  client: CommandClient;
9
10
  constructor(client: CommandClient);
@@ -12,7 +13,8 @@ export declare class Registry {
12
13
  get commands(): Command[];
13
14
  get argumentConverters(): ArgumentConverter[];
14
15
  get slashArgumentConverters(): SlashArgumentConverter[];
15
- get slashCommands(): SlashCommand[];
16
+ get applicationCommands(): AppCommand[];
17
+ get messageComponentHandlers(): MessageComponentHandler[];
16
18
  registerModule(module: Module): Module;
17
19
  loadModulesIn(dir: string, absolute?: boolean): Promise<void>;
18
20
  loadModule(file: string, absolute?: boolean): Promise<Module>;
@@ -38,7 +38,6 @@ const path_1 = __importDefault(require("path"));
38
38
  const error_1 = require("../error");
39
39
  const discord_js_1 = require("discord.js");
40
40
  const walk_sync_1 = __importDefault(require("walk-sync"));
41
- const v9_1 = require("discord-api-types/v9");
42
41
  const fs = __importStar(require("fs"));
43
42
  class Registry {
44
43
  constructor(client) {
@@ -71,10 +70,17 @@ class Registry {
71
70
  }
72
71
  return result;
73
72
  }
74
- get slashCommands() {
73
+ get applicationCommands() {
75
74
  const result = [];
76
75
  for (const [, module] of this.modules) {
77
- result.push(...module.slashCommands);
76
+ result.push(...module.applicationCommands);
77
+ }
78
+ return result;
79
+ }
80
+ get messageComponentHandlers() {
81
+ const result = [];
82
+ for (const [, module] of this.modules) {
83
+ result.push(...module.messageComponentHandlers);
78
84
  }
79
85
  return result;
80
86
  }
@@ -127,21 +133,20 @@ class Registry {
127
133
  });
128
134
  }
129
135
  syncCommands() {
136
+ var _a;
130
137
  return __awaiter(this, void 0, void 0, function* () {
131
138
  this.logger.debug(`Syncing commands...`);
132
- const commands = this.slashCommands.filter((x) => !x.guild);
133
- const guild = this.client.options.slashCommands.guild;
139
+ const commands = this.applicationCommands.filter((x) => !x.guild);
140
+ const guild = this.client.options.applicationCommands.guild;
134
141
  if (guild) {
135
142
  const syncForGuild = (g) => __awaiter(this, void 0, void 0, function* () {
136
143
  this.logger.debug(`Syncing for guild ${g.name}(${g.id})`);
137
144
  const commandsToRegister = [
138
- ...commands.map((x) => x.commandBuilder),
139
- ...this.slashCommands.filter((y) => { var _a; return y.guild === g.id || ((_a = y.guild) === null || _a === void 0 ? void 0 : _a.includes(g.id)) || false; }).map((x) => x.commandBuilder),
145
+ ...commands.map((x) => x.command),
146
+ ...this.applicationCommands.filter((y) => { var _a; return y.guild === g.id || ((_a = y.guild) === null || _a === void 0 ? void 0 : _a.includes(g.id)) || false; }).map((x) => x.command),
140
147
  ];
141
148
  this.logger.debug(`Command List: ${commandsToRegister.map((x) => x.name).join(', ')}`);
142
- yield this.client.rest.put(v9_1.Routes.applicationGuildCommands(this.client.client.application.id, g.id), {
143
- body: commandsToRegister.map((x) => x.toJSON()),
144
- });
149
+ yield g.commands.set(commandsToRegister);
145
150
  });
146
151
  if (typeof guild === 'string') {
147
152
  yield syncForGuild(yield this.client.client.guilds.fetch(guild));
@@ -154,9 +159,7 @@ class Registry {
154
159
  }
155
160
  else {
156
161
  this.logger.debug('Syncing global...');
157
- yield this.client.rest.put(v9_1.Routes.applicationCommands(this.client.client.application.id), {
158
- body: commands.map((x) => x.commandBuilder.toJSON()),
159
- });
162
+ yield ((_a = this.client.client.application) === null || _a === void 0 ? void 0 : _a.commands.set(commands.map((x) => x.command)));
160
163
  }
161
164
  this.logger.debug('Syncing ended.');
162
165
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Registry.js","sourceRoot":"","sources":["../../src/structures/Registry.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qCAAiC;AAEjC,4CAAiF;AACjF,gDAAuB;AACvB,oCAAkF;AAClF,2CAA8C;AAC9C,0DAAgC;AAGhC,6CAA6C;AAC7C,uCAAwB;AAOxB,MAAa,QAAQ;IACnB,YAAmB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;QAExC,YAAO,GAA+B,IAAI,uBAAU,EAAE,CAAA;IAFX,CAAC;IAI5C,IAAY,MAAM;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC;YACvC,IAAI,EAAE,UAAU;SACjB,CAAC,CAAA;IACJ,CAAC;IAED,IAAI,QAAQ;QACV,MAAM,MAAM,GAAc,EAAE,CAAA;QAE5B,KAAK,MAAM,CAAC,EAAE,MAAM,CAAC,IAAI,IAA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EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,0BAAc,EAAE,CAAC,CAAC,CAAC,EAAE;gBACxG,IAAI;oBACF,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA;oBAC/B,OAAO,CAAC,IAAI,CAAC;wBACX,IAAI,EAAE,MAAM,CAAC,IAAK;wBAClB,OAAO,EAAE,IAAI;qBACd,CAAC,CAAA;iBACH;gBAAC,OAAO,CAAM,EAAE;oBACf,OAAO,CAAC,IAAI,CAAC;wBACX,KAAK,EAAE,CAAC;wBACR,IAAI,EAAE,MAAM,CAAC,IAAK;wBAClB,OAAO,EAAE,KAAK;qBACf,CAAC,CAAA;iBACH;aACF;YACD,OAAO,OAAO,CAAA;QAChB,CAAC;KAAA;CACF;AA5MD,4BA4MC"}
package/dist/typings.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { Command } from './command';
2
2
  import { CommandClient } from './structures';
3
- import { SlashCommand } from './slashCommand';
3
+ import { AppCommand } from './applicationCommand';
4
4
  declare module 'discord.js' {
5
5
  interface Message {
6
6
  data: {
@@ -11,7 +11,19 @@ declare module 'discord.js' {
11
11
  }
12
12
  interface CommandInteraction {
13
13
  data: {
14
- command: SlashCommand;
14
+ command: AppCommand;
15
+ cts: CommandClient;
16
+ };
17
+ }
18
+ interface MessageComponentInteraction {
19
+ data: {
20
+ command: AppCommand;
21
+ cts: CommandClient;
22
+ };
23
+ }
24
+ interface ContextMenuInteraction {
25
+ data: {
26
+ command: AppCommand;
15
27
  cts: CommandClient;
16
28
  };
17
29
  }
package/package.json CHANGED
@@ -1,13 +1,11 @@
1
1
  {
2
2
  "name": "@pikokr/command.ts",
3
3
  "description": "Discord.js command framework for typescript.",
4
- "version": "3.2.4-dev.434c22e",
4
+ "version": "3.2.4-dev.535de3c",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "MIT",
8
8
  "devDependencies": {
9
- "@discordjs/builders": "^0.6.0",
10
- "@discordjs/rest": "^0.1.0-canary.0",
11
9
  "@types/lodash": "^4.14.172",
12
10
  "all-contributors-cli": "^6.20.0",
13
11
  "discord.js": "^13.6.0",
@@ -0,0 +1,28 @@
1
+ import { Module } from '../structures'
2
+ import { ApplicationCommandDataResolvable, Snowflake } from 'discord.js'
3
+ import { KApplicationCommandChecks } from '../constants'
4
+ import { ApplicationCommandCheckFunction } from '../command'
5
+
6
+ export type SlashArgument = {
7
+ type: any
8
+ name?: string
9
+ }
10
+
11
+ export class AppCommand {
12
+ get checks(): ApplicationCommandCheckFunction[] {
13
+ return Reflect.getMetadata(KApplicationCommandChecks, this.module, this.key) || []
14
+ }
15
+
16
+ execute(module: Module, args: any[]) {
17
+ return this.run.apply(module, args)
18
+ }
19
+
20
+ constructor(
21
+ public command: ApplicationCommandDataResolvable,
22
+ private run: Function,
23
+ public module: Module,
24
+ public params: SlashArgument[],
25
+ public guild: Snowflake | Snowflake[] | undefined,
26
+ private key: string | symbol,
27
+ ) {}
28
+ }
@@ -1,15 +1,15 @@
1
- import { Collection, Snowflake } from 'discord.js'
1
+ import { ApplicationCommandDataResolvable, Collection, Snowflake } from 'discord.js'
2
2
  import { checkTarget } from '../utils'
3
- import { KSlashCommandOptions, KSlashCommands } from '../constants'
3
+ import { KSlashCommandOptions, KApplicationCommands } from '../constants'
4
4
  import { Module } from '../structures'
5
- import { SlashCommand } from './SlashCommand'
6
- import { SlashCommandBuilder } from '@discordjs/builders'
5
+ import { AppCommand } from './AppCommand'
7
6
 
8
- type SlashOptions = {
7
+ type ApplicationCommandOptions = {
9
8
  guild: Snowflake | Snowflake[]
9
+ optionTypes?: any[]
10
10
  }
11
11
 
12
- export const slashCommand = (opt: Partial<SlashOptions> & { command: SlashCommandBuilder | Omit<SlashCommandBuilder, 'addSubcommand' | 'addSubcommandGroup'> }) => {
12
+ export const applicationCommand = (opt: Partial<ApplicationCommandOptions> & { command: ApplicationCommandDataResolvable }) => {
13
13
  return (
14
14
  target: Object,
15
15
  propertyKey: string,
@@ -17,13 +17,13 @@ export const slashCommand = (opt: Partial<SlashOptions> & { command: SlashComman
17
17
  ) => {
18
18
  checkTarget(target)
19
19
 
20
- let properties: SlashCommand[] = Reflect.getMetadata(KSlashCommands, target)
20
+ let properties: AppCommand[] = Reflect.getMetadata(KApplicationCommands, target)
21
21
 
22
- const params: any[] = Reflect.getMetadata('design:paramtypes', target, propertyKey)
22
+ const params: any[] = opt.optionTypes ?? Reflect.getMetadata('design:paramtypes', target, propertyKey)
23
23
 
24
24
  const options: Collection<number, string> = Reflect.getMetadata(KSlashCommandOptions, target, propertyKey) || new Collection<number, string>()
25
25
 
26
- const command = new SlashCommand(
26
+ const command = new AppCommand(
27
27
  opt.command,
28
28
  Reflect.get(target, propertyKey),
29
29
  target as Module,
@@ -39,7 +39,7 @@ export const slashCommand = (opt: Partial<SlashOptions> & { command: SlashComman
39
39
  properties.push(command)
40
40
  } else {
41
41
  properties = [command]
42
- Reflect.defineMetadata(KSlashCommands, properties, target)
42
+ Reflect.defineMetadata(KApplicationCommands, properties, target)
43
43
  }
44
44
  }
45
45
  }
@@ -0,0 +1,2 @@
1
+ export * from './decorator'
2
+ export * from './AppCommand'