@pikokr/command.ts 4.0.0 → 4.0.1-dev.1c9fbc0

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 (206) hide show
  1. package/dist/index.d.ts +310 -10
  2. package/dist/index.js +1 -22
  3. package/dist/index.js.map +1 -1
  4. package/package.json +6 -3
  5. package/publish-version.js +7 -3
  6. package/src/applicationCommand/AppCommand.ts +4 -0
  7. package/src/applicationCommand/decorator.ts +4 -0
  8. package/src/applicationCommand/index.ts +4 -0
  9. package/src/builtinModules/BuiltInModule.ts +4 -0
  10. package/src/builtinModules/BuiltinApplicationCommandConverters.ts +4 -0
  11. package/src/builtinModules/BuiltinCommandConverters.ts +4 -0
  12. package/src/builtinModules/CommandHandler.ts +4 -0
  13. package/src/builtinModules/index.ts +4 -0
  14. package/src/command/ArgumentConverter.ts +4 -0
  15. package/src/command/Command.ts +4 -0
  16. package/src/command/cooldown/adapter.ts +4 -0
  17. package/src/command/cooldown/decorator.ts +4 -0
  18. package/src/command/cooldown/error.ts +4 -0
  19. package/src/command/cooldown/index.ts +4 -0
  20. package/src/command/cooldown/type.ts +4 -0
  21. package/src/command/decorator.ts +4 -0
  22. package/src/command/index.ts +4 -0
  23. package/src/command/utils.ts +4 -0
  24. package/src/constants.ts +4 -0
  25. package/src/error/ArgumentConverterNotFound.ts +4 -0
  26. package/src/error/ArgumentNotProvided.ts +4 -0
  27. package/src/error/CommandCheckFailed.ts +4 -0
  28. package/src/error/CommandNotFound.ts +4 -0
  29. package/src/error/InvalidTargetError.ts +4 -0
  30. package/src/error/ModuleError.ts +4 -0
  31. package/src/error/PermissionRequired.ts +4 -0
  32. package/src/error/checks/DMOnlyCommand.ts +4 -0
  33. package/src/error/checks/GuildOnlyCommand.ts +4 -0
  34. package/src/error/checks/OwnerOnlyCommand.ts +4 -0
  35. package/src/error/checks/SlashCommandGlobalCheckError.ts +4 -0
  36. package/src/error/checks/index.ts +4 -0
  37. package/src/error/index.ts +4 -0
  38. package/src/index.ts +4 -0
  39. package/src/interface/index.ts +4 -0
  40. package/src/listener/Listener.ts +4 -0
  41. package/src/listener/decorator.ts +4 -0
  42. package/src/listener/index.ts +4 -0
  43. package/src/messageComponents/base.ts +4 -0
  44. package/src/messageComponents/button.ts +4 -0
  45. package/src/messageComponents/index.ts +4 -0
  46. package/src/messageComponents/selectMenu.ts +4 -0
  47. package/src/structures/CommandClient.ts +4 -0
  48. package/src/structures/Module.ts +4 -0
  49. package/src/structures/Registry.ts +37 -12
  50. package/src/structures/index.ts +4 -0
  51. package/src/typings.ts +4 -0
  52. package/src/utils.ts +4 -0
  53. package/test/index.ts +4 -0
  54. package/test/modules/dev.ts +4 -0
  55. package/test/modules/test.ts +5 -1
  56. package/tsup.config.ts +14 -0
  57. package/dist/applicationCommand/AppCommand.d.ts +0 -18
  58. package/dist/applicationCommand/AppCommand.js +0 -22
  59. package/dist/applicationCommand/AppCommand.js.map +0 -1
  60. package/dist/applicationCommand/decorator.d.ts +0 -10
  61. package/dist/applicationCommand/decorator.js +0 -39
  62. package/dist/applicationCommand/decorator.js.map +0 -1
  63. package/dist/applicationCommand/index.d.ts +0 -2
  64. package/dist/applicationCommand/index.js +0 -15
  65. package/dist/applicationCommand/index.js.map +0 -1
  66. package/dist/builtinModules/BuiltInModule.d.ts +0 -4
  67. package/dist/builtinModules/BuiltInModule.js +0 -13
  68. package/dist/builtinModules/BuiltInModule.js.map +0 -1
  69. package/dist/builtinModules/BuiltinApplicationCommandConverters.d.ts +0 -8
  70. package/dist/builtinModules/BuiltinApplicationCommandConverters.js +0 -13
  71. package/dist/builtinModules/BuiltinApplicationCommandConverters.js.map +0 -1
  72. package/dist/builtinModules/BuiltinCommandConverters.d.ts +0 -16
  73. package/dist/builtinModules/BuiltinCommandConverters.js +0 -127
  74. package/dist/builtinModules/BuiltinCommandConverters.js.map +0 -1
  75. package/dist/builtinModules/BuiltinSlashCommandConverters.d.ts +0 -10
  76. package/dist/builtinModules/BuiltinSlashCommandConverters.js +0 -42
  77. package/dist/builtinModules/BuiltinSlashCommandConverters.js.map +0 -1
  78. package/dist/builtinModules/CommandHandler.d.ts +0 -14
  79. package/dist/builtinModules/CommandHandler.js +0 -357
  80. package/dist/builtinModules/CommandHandler.js.map +0 -1
  81. package/dist/builtinModules/index.d.ts +0 -3
  82. package/dist/builtinModules/index.js +0 -16
  83. package/dist/builtinModules/index.js.map +0 -1
  84. package/dist/command/ArgumentConverter.d.ts +0 -15
  85. package/dist/command/ArgumentConverter.js +0 -25
  86. package/dist/command/ArgumentConverter.js.map +0 -1
  87. package/dist/command/Command.d.ts +0 -20
  88. package/dist/command/Command.js +0 -22
  89. package/dist/command/Command.js.map +0 -1
  90. package/dist/command/cooldown/adapter.d.ts +0 -10
  91. package/dist/command/cooldown/adapter.js +0 -31
  92. package/dist/command/cooldown/adapter.js.map +0 -1
  93. package/dist/command/cooldown/decorator.d.ts +0 -2
  94. package/dist/command/cooldown/decorator.js +0 -73
  95. package/dist/command/cooldown/decorator.js.map +0 -1
  96. package/dist/command/cooldown/error.d.ts +0 -4
  97. package/dist/command/cooldown/error.js +0 -11
  98. package/dist/command/cooldown/error.js.map +0 -1
  99. package/dist/command/cooldown/index.d.ts +0 -5
  100. package/dist/command/cooldown/index.js +0 -18
  101. package/dist/command/cooldown/index.js.map +0 -1
  102. package/dist/command/cooldown/type.d.ts +0 -8
  103. package/dist/command/cooldown/type.js +0 -13
  104. package/dist/command/cooldown/type.js.map +0 -1
  105. package/dist/command/decorator.d.ts +0 -17
  106. package/dist/command/decorator.js +0 -138
  107. package/dist/command/decorator.js.map +0 -1
  108. package/dist/command/index.d.ts +0 -5
  109. package/dist/command/index.js +0 -18
  110. package/dist/command/index.js.map +0 -1
  111. package/dist/command/utils.d.ts +0 -2
  112. package/dist/command/utils.js +0 -30
  113. package/dist/command/utils.js.map +0 -1
  114. package/dist/constants.d.ts +0 -14
  115. package/dist/constants.js +0 -18
  116. package/dist/constants.js.map +0 -1
  117. package/dist/error/ArgumentConverterNotFound.d.ts +0 -13
  118. package/dist/error/ArgumentConverterNotFound.js +0 -20
  119. package/dist/error/ArgumentConverterNotFound.js.map +0 -1
  120. package/dist/error/ArgumentNotProvided.d.ts +0 -8
  121. package/dist/error/ArgumentNotProvided.js +0 -13
  122. package/dist/error/ArgumentNotProvided.js.map +0 -1
  123. package/dist/error/CommandCheckFailed.d.ts +0 -13
  124. package/dist/error/CommandCheckFailed.js +0 -20
  125. package/dist/error/CommandCheckFailed.js.map +0 -1
  126. package/dist/error/CommandNotFound.d.ts +0 -7
  127. package/dist/error/CommandNotFound.js +0 -13
  128. package/dist/error/CommandNotFound.js.map +0 -1
  129. package/dist/error/InvalidTargetError.d.ts +0 -3
  130. package/dist/error/InvalidTargetError.js +0 -10
  131. package/dist/error/InvalidTargetError.js.map +0 -1
  132. package/dist/error/ModuleError.d.ts +0 -6
  133. package/dist/error/ModuleError.js +0 -14
  134. package/dist/error/ModuleError.js.map +0 -1
  135. package/dist/error/PermissionRequired.d.ts +0 -10
  136. package/dist/error/PermissionRequired.js +0 -19
  137. package/dist/error/PermissionRequired.js.map +0 -1
  138. package/dist/error/checks/DMOnlyCommand.d.ts +0 -3
  139. package/dist/error/checks/DMOnlyCommand.js +0 -10
  140. package/dist/error/checks/DMOnlyCommand.js.map +0 -1
  141. package/dist/error/checks/GuildOnlyCommand.d.ts +0 -3
  142. package/dist/error/checks/GuildOnlyCommand.js +0 -10
  143. package/dist/error/checks/GuildOnlyCommand.js.map +0 -1
  144. package/dist/error/checks/OwnerOnlyCommand.d.ts +0 -3
  145. package/dist/error/checks/OwnerOnlyCommand.js +0 -10
  146. package/dist/error/checks/OwnerOnlyCommand.js.map +0 -1
  147. package/dist/error/checks/SlashCommandGlobalCheckError.d.ts +0 -5
  148. package/dist/error/checks/SlashCommandGlobalCheckError.js +0 -11
  149. package/dist/error/checks/SlashCommandGlobalCheckError.js.map +0 -1
  150. package/dist/error/checks/index.d.ts +0 -3
  151. package/dist/error/checks/index.js +0 -16
  152. package/dist/error/checks/index.js.map +0 -1
  153. package/dist/error/index.d.ts +0 -7
  154. package/dist/error/index.js +0 -20
  155. package/dist/error/index.js.map +0 -1
  156. package/dist/interface/index.d.ts +0 -1
  157. package/dist/interface/index.js +0 -4
  158. package/dist/interface/index.js.map +0 -1
  159. package/dist/listener/Listener.d.ts +0 -5
  160. package/dist/listener/Listener.js +0 -11
  161. package/dist/listener/Listener.js.map +0 -1
  162. package/dist/listener/decorator.d.ts +0 -2
  163. package/dist/listener/decorator.js +0 -22
  164. package/dist/listener/decorator.js.map +0 -1
  165. package/dist/listener/index.d.ts +0 -2
  166. package/dist/listener/index.js +0 -15
  167. package/dist/listener/index.js.map +0 -1
  168. package/dist/messageComponents/base.d.ts +0 -10
  169. package/dist/messageComponents/base.js +0 -15
  170. package/dist/messageComponents/base.js.map +0 -1
  171. package/dist/messageComponents/button.d.ts +0 -5
  172. package/dist/messageComponents/button.js +0 -28
  173. package/dist/messageComponents/button.js.map +0 -1
  174. package/dist/messageComponents/index.d.ts +0 -2
  175. package/dist/messageComponents/index.js +0 -15
  176. package/dist/messageComponents/index.js.map +0 -1
  177. package/dist/messageComponents/selectMenu.d.ts +0 -5
  178. package/dist/messageComponents/selectMenu.js +0 -28
  179. package/dist/messageComponents/selectMenu.js.map +0 -1
  180. package/dist/slashCommand/SlashCommand.d.ts +0 -19
  181. package/dist/slashCommand/SlashCommand.js +0 -22
  182. package/dist/slashCommand/SlashCommand.js.map +0 -1
  183. package/dist/slashCommand/decorator.d.ts +0 -11
  184. package/dist/slashCommand/decorator.js +0 -39
  185. package/dist/slashCommand/decorator.js.map +0 -1
  186. package/dist/slashCommand/index.d.ts +0 -2
  187. package/dist/slashCommand/index.js +0 -15
  188. package/dist/slashCommand/index.js.map +0 -1
  189. package/dist/structures/CommandClient.d.ts +0 -45
  190. package/dist/structures/CommandClient.js +0 -94
  191. package/dist/structures/CommandClient.js.map +0 -1
  192. package/dist/structures/Module.d.ts +0 -21
  193. package/dist/structures/Module.js +0 -38
  194. package/dist/structures/Module.js.map +0 -1
  195. package/dist/structures/Registry.d.ts +0 -30
  196. package/dist/structures/Registry.js +0 -226
  197. package/dist/structures/Registry.js.map +0 -1
  198. package/dist/structures/index.d.ts +0 -3
  199. package/dist/structures/index.js +0 -16
  200. package/dist/structures/index.js.map +0 -1
  201. package/dist/typings.d.ts +0 -30
  202. package/dist/typings.js +0 -3
  203. package/dist/typings.js.map +0 -1
  204. package/dist/utils.d.ts +0 -1
  205. package/dist/utils.js +0 -11
  206. package/dist/utils.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../src/applicationCommand/decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAoF;AACpF,oCAAsC;AACtC,4CAAyE;AAEzE,6CAAyC;AAOlC,MAAM,kBAAkB,GAAG,CAAC,GAAuF,EAAE,EAAE;IAC5H,OAAO,CACL,MAAc,EACd,WAAmB,EAEnB,EAAE;;QACF,mBAAW,CAAC,MAAM,CAAC,CAAA;QAEnB,IAAI,UAAU,GAAiB,OAAO,CAAC,WAAW,CAAC,gCAAoB,EAAE,MAAM,CAAC,CAAA;QAEhF,MAAM,MAAM,GAAU,MAAA,GAAG,CAAC,WAAW,mCAAI,OAAO,CAAC,WAAW,CAAC,mBAAmB,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;QAEtG,MAAM,OAAO,GAA+B,OAAO,CAAC,WAAW,CAAC,gCAAoB,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,IAAI,uBAAU,EAAkB,CAAA;QAE9I,MAAM,OAAO,GAAG,IAAI,uBAAU,CAC5B,GAAG,CAAC,OAAO,EACX,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,EAChC,MAAgB,EAChB,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YACpB,IAAI,EAAE,CAAC;YACP,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;SACrB,CAAC,CAAC,EACH,GAAG,CAAC,KAAK,EACT,WAAW,CACZ,CAAA;QAED,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,gCAAoB,EAAE,UAAU,EAAE,MAAM,CAAC,CAAA;SACjE;IACH,CAAC,CAAA;AACH,CAAC,CAAA;AAjCY,QAAA,kBAAkB,sBAiC9B;AAEM,MAAM,MAAM,GAAG,CAAC,GAAW,EAAsB,EAAE,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,EAAE;IACjG,mBAAW,CAAC,MAAM,CAAC,CAAA;IAEnB,IAAI,UAAU,GAA+B,OAAO,CAAC,WAAW,CAAC,gCAAoB,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;IAE3G,IAAI,CAAC,UAAU,EAAE;QACf,UAAU,GAAG,IAAI,uBAAU,EAAkB,CAAA;QAC7C,OAAO,CAAC,cAAc,CAAC,gCAAoB,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;KAC9E;IAED,UAAU,CAAC,GAAG,CAAC,cAAc,EAAE,GAAG,CAAC,CAAA;AACrC,CAAC,CAAA;AAXY,QAAA,MAAM,UAWlB"}
@@ -1,2 +0,0 @@
1
- export * from './decorator';
2
- export * from './AppCommand';
@@ -1,15 +0,0 @@
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("./decorator"), exports);
14
- __exportStar(require("./AppCommand"), exports);
15
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/applicationCommand/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAA2B;AAC3B,+CAA4B"}
@@ -1,4 +0,0 @@
1
- import { Module } from '../structures';
2
- export declare class BuiltInModule extends Module {
3
- constructor();
4
- }
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BuiltInModule = void 0;
4
- const structures_1 = require("../structures");
5
- const constants_1 = require("../constants");
6
- class BuiltInModule extends structures_1.Module {
7
- constructor() {
8
- super();
9
- Reflect.defineMetadata(constants_1.KBuiltInModule, true, this);
10
- }
11
- }
12
- exports.BuiltInModule = BuiltInModule;
13
- //# sourceMappingURL=BuiltInModule.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BuiltInModule.js","sourceRoot":"","sources":["../../src/builtinModules/BuiltInModule.ts"],"names":[],"mappings":";;;AAAA,8CAAsC;AACtC,4CAA6C;AAE7C,MAAa,aAAc,SAAQ,mBAAM;IACvC;QACE,KAAK,EAAE,CAAA;QACP,OAAO,CAAC,cAAc,CAAC,0BAAc,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;IACpD,CAAC;CACF;AALD,sCAKC"}
@@ -1,8 +0,0 @@
1
- import { BuiltInModule } from './BuiltInModule';
2
- import { Client } from 'discord.js';
3
- import { CommandClient } from '../structures';
4
- export declare class BuiltinApplicationCommandConverters extends BuiltInModule {
5
- private cts;
6
- client: Client;
7
- constructor(cts: CommandClient);
8
- }
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BuiltinApplicationCommandConverters = void 0;
4
- const BuiltInModule_1 = require("./BuiltInModule");
5
- class BuiltinApplicationCommandConverters extends BuiltInModule_1.BuiltInModule {
6
- constructor(cts) {
7
- super();
8
- this.cts = cts;
9
- this.client = cts.client;
10
- }
11
- }
12
- exports.BuiltinApplicationCommandConverters = BuiltinApplicationCommandConverters;
13
- //# sourceMappingURL=BuiltinApplicationCommandConverters.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BuiltinApplicationCommandConverters.js","sourceRoot":"","sources":["../../src/builtinModules/BuiltinApplicationCommandConverters.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AAI/C,MAAa,mCAAoC,SAAQ,6BAAa;IAGpE,YAAoB,GAAkB;QACpC,KAAK,EAAE,CAAA;QADW,QAAG,GAAH,GAAG,CAAe;QAEpC,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAA;IAC1B,CAAC;CACF;AAPD,kFAOC"}
@@ -1,16 +0,0 @@
1
- import { BuiltInModule } from './BuiltInModule';
2
- import { Client, GuildMember, Message, User, Role } from 'discord.js';
3
- import { CommandClient } from '../structures';
4
- export declare class BuiltinCommandConverters extends BuiltInModule {
5
- private cts;
6
- client: Client;
7
- constructor(cts: CommandClient);
8
- message(msg: Message): Message<boolean>;
9
- string(msg: Message, arg: string): string;
10
- getUserIDByMention(mention: string): `${bigint}` | undefined;
11
- user(msg: Message, value: string): User | null;
12
- member(msg: Message, value: string): GuildMember | undefined;
13
- number(msg: Message, value: string): number | undefined;
14
- getRoleIDByMention(mention: string): `${bigint}` | undefined;
15
- role(msg: Message, value: string): Role | undefined;
16
- }
@@ -1,127 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.BuiltinCommandConverters = void 0;
13
- const BuiltInModule_1 = require("./BuiltInModule");
14
- const command_1 = require("../command");
15
- const discord_js_1 = require("discord.js");
16
- class BuiltinCommandConverters extends BuiltInModule_1.BuiltInModule {
17
- constructor(cts) {
18
- super();
19
- this.cts = cts;
20
- this.client = cts.client;
21
- }
22
- message(msg) {
23
- return msg;
24
- }
25
- string(msg, arg) {
26
- return arg;
27
- }
28
- getUserIDByMention(mention) {
29
- if (!mention)
30
- return;
31
- if (mention.startsWith('<@') && mention.endsWith('>')) {
32
- mention = mention.slice(2, -1);
33
- if (mention.startsWith('!')) {
34
- mention = mention.slice(1);
35
- }
36
- return mention;
37
- }
38
- }
39
- user(msg, value) {
40
- let user = this.client.users.cache.get(value);
41
- if (user)
42
- return user;
43
- user = this.client.users.cache.find((x) => x.tag === value || x.username === value);
44
- if (user)
45
- return user;
46
- const id = this.getUserIDByMention(value);
47
- if (!id)
48
- return null;
49
- user = this.client.users.cache.get(id);
50
- return user || null;
51
- }
52
- member(msg, value) {
53
- var _a, _b, _c;
54
- let user = (_a = msg.guild) === null || _a === void 0 ? void 0 : _a.members.cache.get(value);
55
- if (!user)
56
- return user;
57
- user = (_b = msg.guild) === null || _b === void 0 ? void 0 : _b.members.cache.find((x) => x.user.tag === value);
58
- if (user)
59
- return user;
60
- const id = this.getUserIDByMention(value);
61
- if (!id)
62
- return;
63
- user = (_c = msg.guild) === null || _c === void 0 ? void 0 : _c.members.cache.get(id);
64
- return user || undefined;
65
- }
66
- number(msg, value) {
67
- const n = Number(value);
68
- return isNaN(n) ? undefined : n;
69
- }
70
- getRoleIDByMention(mention) {
71
- if (!mention)
72
- return;
73
- if (mention.startsWith('<@') && mention.endsWith('>')) {
74
- mention = mention.slice(2, -1);
75
- if (mention.startsWith('&')) {
76
- mention = mention.slice(1);
77
- }
78
- return mention;
79
- }
80
- }
81
- role(msg, value) {
82
- var _a;
83
- const id = this.getRoleIDByMention(value);
84
- if (!id)
85
- return;
86
- const role = (_a = msg.guild) === null || _a === void 0 ? void 0 : _a.roles.cache.get(id);
87
- return role || undefined;
88
- }
89
- }
90
- __decorate([
91
- command_1.argumentConverter(discord_js_1.Message, false),
92
- __metadata("design:type", Function),
93
- __metadata("design:paramtypes", [discord_js_1.Message]),
94
- __metadata("design:returntype", void 0)
95
- ], BuiltinCommandConverters.prototype, "message", null);
96
- __decorate([
97
- command_1.argumentConverter(String),
98
- __metadata("design:type", Function),
99
- __metadata("design:paramtypes", [discord_js_1.Message, String]),
100
- __metadata("design:returntype", void 0)
101
- ], BuiltinCommandConverters.prototype, "string", null);
102
- __decorate([
103
- command_1.argumentConverter(discord_js_1.User),
104
- __metadata("design:type", Function),
105
- __metadata("design:paramtypes", [discord_js_1.Message, String]),
106
- __metadata("design:returntype", Object)
107
- ], BuiltinCommandConverters.prototype, "user", null);
108
- __decorate([
109
- command_1.argumentConverter(discord_js_1.GuildMember),
110
- __metadata("design:type", Function),
111
- __metadata("design:paramtypes", [discord_js_1.Message, String]),
112
- __metadata("design:returntype", Object)
113
- ], BuiltinCommandConverters.prototype, "member", null);
114
- __decorate([
115
- command_1.argumentConverter(Number),
116
- __metadata("design:type", Function),
117
- __metadata("design:paramtypes", [discord_js_1.Message, String]),
118
- __metadata("design:returntype", void 0)
119
- ], BuiltinCommandConverters.prototype, "number", null);
120
- __decorate([
121
- command_1.argumentConverter(discord_js_1.Role),
122
- __metadata("design:type", Function),
123
- __metadata("design:paramtypes", [discord_js_1.Message, String]),
124
- __metadata("design:returntype", Object)
125
- ], BuiltinCommandConverters.prototype, "role", null);
126
- exports.BuiltinCommandConverters = BuiltinCommandConverters;
127
- //# sourceMappingURL=BuiltinCommandConverters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,OAAO;YAAE,OAAM;QACpB,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACrD,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;YAC9B,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;gBAC3B,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;aAC3B;YACD,OAAO,OAAsB,CAAA;SAC9B;IACH,CAAC;IAGD,IAAI,CAAC,GAAY,EAAE,KAAa;;QAC9B,MAAM,EAAE,GAAG,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAA;QACzC,IAAI,CAAC,EAAE;YAAE,OAAM;QACf,MAAM,IAAI,GAAG,MAAA,GAAG,CAAC,KAAK,0CAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;QAC3C,OAAO,IAAI,IAAI,SAAS,CAAA;IAC1B,CAAC;CACF;AApEC;IADC,2BAAiB,CAAC,oBAAO,EAAE,KAAK,CAAC;;qCACrB,oBAAO;;uDAEnB;AAGD;IADC,2BAAiB,CAAC,MAAM,CAAC;;qCACd,oBAAO;;sDAElB;AAcD;IADC,2BAAiB,CAAC,iBAAI,CAAC;;qCACd,oBAAO;;oDAShB;AAGD;IADC,2BAAiB,CAAC,wBAAW,CAAC;;qCACnB,oBAAO;;sDASlB;AAGD;IADC,2BAAiB,CAAC,MAAM,CAAC;;qCACd,oBAAO;;sDAGlB;AAcD;IADC,2BAAiB,CAAC,iBAAI,CAAC;;qCACd,oBAAO;;oDAKhB;AA5EH,4DA6EC"}
@@ -1,10 +0,0 @@
1
- import { BuiltInModule } from './BuiltInModule';
2
- import { Client, CommandInteraction, CommandInteractionOptionResolver } from 'discord.js';
3
- import { CommandClient } from '../structures';
4
- export declare class BuiltinSlashCommandConverters extends BuiltInModule {
5
- private cts;
6
- client: Client;
7
- constructor(cts: CommandClient);
8
- message(interaction: CommandInteraction): CommandInteraction<import("discord.js").CacheType>;
9
- optionResolver(interaction: CommandInteraction): CommandInteractionOptionResolver;
10
- }
@@ -1,42 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.BuiltinSlashCommandConverters = void 0;
13
- const BuiltInModule_1 = require("./BuiltInModule");
14
- const command_1 = require("../command");
15
- const discord_js_1 = require("discord.js");
16
- class BuiltinSlashCommandConverters extends BuiltInModule_1.BuiltInModule {
17
- constructor(cts) {
18
- super();
19
- this.cts = cts;
20
- this.client = cts.client;
21
- }
22
- message(interaction) {
23
- return interaction;
24
- }
25
- optionResolver(interaction) {
26
- return interaction.options;
27
- }
28
- }
29
- __decorate([
30
- command_1.slashArgumentConverter(discord_js_1.CommandInteraction),
31
- __metadata("design:type", Function),
32
- __metadata("design:paramtypes", [discord_js_1.CommandInteraction]),
33
- __metadata("design:returntype", void 0)
34
- ], BuiltinSlashCommandConverters.prototype, "message", null);
35
- __decorate([
36
- command_1.slashArgumentConverter(discord_js_1.CommandInteractionOptionResolver),
37
- __metadata("design:type", Function),
38
- __metadata("design:paramtypes", [discord_js_1.CommandInteraction]),
39
- __metadata("design:returntype", discord_js_1.CommandInteractionOptionResolver)
40
- ], BuiltinSlashCommandConverters.prototype, "optionResolver", null);
41
- exports.BuiltinSlashCommandConverters = BuiltinSlashCommandConverters;
42
- //# sourceMappingURL=BuiltinSlashCommandConverters.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BuiltinSlashCommandConverters.js","sourceRoot":"","sources":["../../src/builtinModules/BuiltinSlashCommandConverters.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mDAA+C;AAC/C,wCAAmD;AACnD,2CAAyF;AAGzF,MAAa,6BAA8B,SAAQ,6BAAa;IAG9D,YAAoB,GAAkB;QACpC,KAAK,EAAE,CAAA;QADW,QAAG,GAAH,GAAG,CAAe;QAEpC,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAA;IAC1B,CAAC;IAGD,OAAO,CAAC,WAA+B;QACrC,OAAO,WAAW,CAAA;IACpB,CAAC;IAGD,cAAc,CAAC,WAA+B;QAC5C,OAAO,WAAW,CAAC,OAA2C,CAAA;IAChE,CAAC;CACF;AARC;IADC,gCAAsB,CAAC,+BAAkB,CAAC;;qCACtB,+BAAkB;;4DAEtC;AAGD;IADC,gCAAsB,CAAC,6CAAgC,CAAC;;qCAC7B,+BAAkB;oCAAG,6CAAgC;mEAEhF;AAhBH,sEAiBC"}
@@ -1,14 +0,0 @@
1
- import { BuiltInModule } from './BuiltInModule';
2
- import { Registry } from '../structures';
3
- import { Interaction, Message } from 'discord.js';
4
- export declare class CommandHandler extends BuiltInModule {
5
- private registry;
6
- private readonly client;
7
- constructor(registry: Registry);
8
- message(msg: Message): Promise<boolean | undefined>;
9
- private command;
10
- private messageComponent;
11
- private userContextMenu;
12
- private messageContextMenu;
13
- interaction(i: Interaction): Promise<boolean | undefined>;
14
- }