@pikokr/command.ts 4.0.0-dev.fddc66b → 4.0.2-dev.6d75eff

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 (146) hide show
  1. package/dist/index.d.ts +310 -10
  2. package/dist/index.js +1 -25
  3. package/dist/index.js.map +1 -1
  4. package/package.json +5 -2
  5. package/src/structures/Registry.ts +30 -12
  6. package/test/modules/dev.ts +1 -0
  7. package/tsconfig.json +1 -1
  8. package/tsup.config.ts +14 -0
  9. package/dist/applicationCommand/AppCommand.d.ts +0 -18
  10. package/dist/applicationCommand/AppCommand.js +0 -25
  11. package/dist/applicationCommand/AppCommand.js.map +0 -1
  12. package/dist/applicationCommand/decorator.d.ts +0 -10
  13. package/dist/applicationCommand/decorator.js +0 -42
  14. package/dist/applicationCommand/decorator.js.map +0 -1
  15. package/dist/applicationCommand/index.d.ts +0 -2
  16. package/dist/applicationCommand/index.js +0 -18
  17. package/dist/applicationCommand/index.js.map +0 -1
  18. package/dist/builtinModules/BuiltInModule.d.ts +0 -4
  19. package/dist/builtinModules/BuiltInModule.js +0 -16
  20. package/dist/builtinModules/BuiltInModule.js.map +0 -1
  21. package/dist/builtinModules/BuiltinApplicationCommandConverters.d.ts +0 -8
  22. package/dist/builtinModules/BuiltinApplicationCommandConverters.js +0 -16
  23. package/dist/builtinModules/BuiltinApplicationCommandConverters.js.map +0 -1
  24. package/dist/builtinModules/BuiltinCommandConverters.d.ts +0 -16
  25. package/dist/builtinModules/BuiltinCommandConverters.js +0 -130
  26. package/dist/builtinModules/BuiltinCommandConverters.js.map +0 -1
  27. package/dist/builtinModules/CommandHandler.d.ts +0 -14
  28. package/dist/builtinModules/CommandHandler.js +0 -360
  29. package/dist/builtinModules/CommandHandler.js.map +0 -1
  30. package/dist/builtinModules/index.d.ts +0 -3
  31. package/dist/builtinModules/index.js +0 -19
  32. package/dist/builtinModules/index.js.map +0 -1
  33. package/dist/command/ArgumentConverter.d.ts +0 -15
  34. package/dist/command/ArgumentConverter.js +0 -28
  35. package/dist/command/ArgumentConverter.js.map +0 -1
  36. package/dist/command/Command.d.ts +0 -20
  37. package/dist/command/Command.js +0 -25
  38. package/dist/command/Command.js.map +0 -1
  39. package/dist/command/cooldown/adapter.d.ts +0 -10
  40. package/dist/command/cooldown/adapter.js +0 -34
  41. package/dist/command/cooldown/adapter.js.map +0 -1
  42. package/dist/command/cooldown/decorator.d.ts +0 -2
  43. package/dist/command/cooldown/decorator.js +0 -76
  44. package/dist/command/cooldown/decorator.js.map +0 -1
  45. package/dist/command/cooldown/error.d.ts +0 -4
  46. package/dist/command/cooldown/error.js +0 -14
  47. package/dist/command/cooldown/error.js.map +0 -1
  48. package/dist/command/cooldown/index.d.ts +0 -5
  49. package/dist/command/cooldown/index.js +0 -21
  50. package/dist/command/cooldown/index.js.map +0 -1
  51. package/dist/command/cooldown/type.d.ts +0 -8
  52. package/dist/command/cooldown/type.js +0 -16
  53. package/dist/command/cooldown/type.js.map +0 -1
  54. package/dist/command/decorator.d.ts +0 -17
  55. package/dist/command/decorator.js +0 -141
  56. package/dist/command/decorator.js.map +0 -1
  57. package/dist/command/index.d.ts +0 -5
  58. package/dist/command/index.js +0 -21
  59. package/dist/command/index.js.map +0 -1
  60. package/dist/command/utils.d.ts +0 -2
  61. package/dist/command/utils.js +0 -33
  62. package/dist/command/utils.js.map +0 -1
  63. package/dist/constants.d.ts +0 -14
  64. package/dist/constants.js +0 -21
  65. package/dist/constants.js.map +0 -1
  66. package/dist/error/ArgumentConverterNotFound.d.ts +0 -13
  67. package/dist/error/ArgumentConverterNotFound.js +0 -23
  68. package/dist/error/ArgumentConverterNotFound.js.map +0 -1
  69. package/dist/error/ArgumentNotProvided.d.ts +0 -8
  70. package/dist/error/ArgumentNotProvided.js +0 -16
  71. package/dist/error/ArgumentNotProvided.js.map +0 -1
  72. package/dist/error/CommandCheckFailed.d.ts +0 -13
  73. package/dist/error/CommandCheckFailed.js +0 -23
  74. package/dist/error/CommandCheckFailed.js.map +0 -1
  75. package/dist/error/CommandNotFound.d.ts +0 -7
  76. package/dist/error/CommandNotFound.js +0 -16
  77. package/dist/error/CommandNotFound.js.map +0 -1
  78. package/dist/error/InvalidTargetError.d.ts +0 -3
  79. package/dist/error/InvalidTargetError.js +0 -13
  80. package/dist/error/InvalidTargetError.js.map +0 -1
  81. package/dist/error/ModuleError.d.ts +0 -6
  82. package/dist/error/ModuleError.js +0 -17
  83. package/dist/error/ModuleError.js.map +0 -1
  84. package/dist/error/PermissionRequired.d.ts +0 -10
  85. package/dist/error/PermissionRequired.js +0 -22
  86. package/dist/error/PermissionRequired.js.map +0 -1
  87. package/dist/error/checks/DMOnlyCommand.d.ts +0 -3
  88. package/dist/error/checks/DMOnlyCommand.js +0 -13
  89. package/dist/error/checks/DMOnlyCommand.js.map +0 -1
  90. package/dist/error/checks/GuildOnlyCommand.d.ts +0 -3
  91. package/dist/error/checks/GuildOnlyCommand.js +0 -13
  92. package/dist/error/checks/GuildOnlyCommand.js.map +0 -1
  93. package/dist/error/checks/OwnerOnlyCommand.d.ts +0 -3
  94. package/dist/error/checks/OwnerOnlyCommand.js +0 -13
  95. package/dist/error/checks/OwnerOnlyCommand.js.map +0 -1
  96. package/dist/error/checks/SlashCommandGlobalCheckError.d.ts +0 -5
  97. package/dist/error/checks/SlashCommandGlobalCheckError.js +0 -14
  98. package/dist/error/checks/SlashCommandGlobalCheckError.js.map +0 -1
  99. package/dist/error/checks/index.d.ts +0 -3
  100. package/dist/error/checks/index.js +0 -19
  101. package/dist/error/checks/index.js.map +0 -1
  102. package/dist/error/index.d.ts +0 -7
  103. package/dist/error/index.js +0 -23
  104. package/dist/error/index.js.map +0 -1
  105. package/dist/interface/index.d.ts +0 -1
  106. package/dist/interface/index.js +0 -6
  107. package/dist/interface/index.js.map +0 -1
  108. package/dist/listener/Listener.d.ts +0 -5
  109. package/dist/listener/Listener.js +0 -14
  110. package/dist/listener/Listener.js.map +0 -1
  111. package/dist/listener/decorator.d.ts +0 -2
  112. package/dist/listener/decorator.js +0 -25
  113. package/dist/listener/decorator.js.map +0 -1
  114. package/dist/listener/index.d.ts +0 -2
  115. package/dist/listener/index.js +0 -18
  116. package/dist/listener/index.js.map +0 -1
  117. package/dist/messageComponents/base.d.ts +0 -10
  118. package/dist/messageComponents/base.js +0 -18
  119. package/dist/messageComponents/base.js.map +0 -1
  120. package/dist/messageComponents/button.d.ts +0 -5
  121. package/dist/messageComponents/button.js +0 -31
  122. package/dist/messageComponents/button.js.map +0 -1
  123. package/dist/messageComponents/index.d.ts +0 -2
  124. package/dist/messageComponents/index.js +0 -18
  125. package/dist/messageComponents/index.js.map +0 -1
  126. package/dist/messageComponents/selectMenu.d.ts +0 -5
  127. package/dist/messageComponents/selectMenu.js +0 -31
  128. package/dist/messageComponents/selectMenu.js.map +0 -1
  129. package/dist/structures/CommandClient.d.ts +0 -45
  130. package/dist/structures/CommandClient.js +0 -97
  131. package/dist/structures/CommandClient.js.map +0 -1
  132. package/dist/structures/Module.d.ts +0 -21
  133. package/dist/structures/Module.js +0 -41
  134. package/dist/structures/Module.js.map +0 -1
  135. package/dist/structures/Registry.d.ts +0 -30
  136. package/dist/structures/Registry.js +0 -229
  137. package/dist/structures/Registry.js.map +0 -1
  138. package/dist/structures/index.d.ts +0 -3
  139. package/dist/structures/index.js +0 -19
  140. package/dist/structures/index.js.map +0 -1
  141. package/dist/typings.d.ts +0 -30
  142. package/dist/typings.js +0 -6
  143. package/dist/typings.js.map +0 -1
  144. package/dist/utils.d.ts +0 -1
  145. package/dist/utils.js +0 -14
  146. package/dist/utils.js.map +0 -1
@@ -1,30 +0,0 @@
1
- import { CommandClient } from './CommandClient';
2
- import { Module } from './Module';
3
- import { Command, ApplicationCommandArgumentConverter } from '../command';
4
- import { Collection } from 'discord.js';
5
- import { ArgumentConverter } from '../command';
6
- import { AppCommand } from '../applicationCommand';
7
- import { MessageComponentHandler } from '../messageComponents/base';
8
- export declare class Registry {
9
- client: CommandClient;
10
- constructor(client: CommandClient);
11
- modules: Collection<symbol, Module>;
12
- private get logger();
13
- get commands(): Command[];
14
- get argumentConverters(): ArgumentConverter[];
15
- get applicationCommandArgumentConverters(): ApplicationCommandArgumentConverter[];
16
- get applicationCommands(): AppCommand[];
17
- get messageComponentHandlers(): MessageComponentHandler[];
18
- registerModule(module: Module): Module;
19
- loadModulesIn(dir: string, absolute?: boolean): Promise<void>;
20
- loadModule(file: string, absolute?: boolean): Promise<Module>;
21
- syncCommands(): Promise<void>;
22
- unregisterModule(module: Module): Promise<Module>;
23
- unloadModule(module: Module): Promise<void>;
24
- reloadModule(module: Module): Promise<boolean>;
25
- reloadAll(): Promise<{
26
- path: string;
27
- success: boolean;
28
- error?: Error | undefined;
29
- }[]>;
30
- }
@@ -1,229 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2022 pikokr. Licensed under the MIT license
4
- */
5
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
8
- }) : (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- o[k2] = m[k];
11
- }));
12
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
13
- Object.defineProperty(o, "default", { enumerable: true, value: v });
14
- }) : function(o, v) {
15
- o["default"] = v;
16
- });
17
- var __importStar = (this && this.__importStar) || function (mod) {
18
- if (mod && mod.__esModule) return mod;
19
- var result = {};
20
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
21
- __setModuleDefault(result, mod);
22
- return result;
23
- };
24
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
25
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
26
- return new (P || (P = Promise))(function (resolve, reject) {
27
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
28
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
29
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
30
- step((generator = generator.apply(thisArg, _arguments || [])).next());
31
- });
32
- };
33
- var __importDefault = (this && this.__importDefault) || function (mod) {
34
- return (mod && mod.__esModule) ? mod : { "default": mod };
35
- };
36
- Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.Registry = void 0;
38
- const Module_1 = require("./Module");
39
- const constants_1 = require("../constants");
40
- const path_1 = __importDefault(require("path"));
41
- const error_1 = require("../error");
42
- const discord_js_1 = require("discord.js");
43
- const walk_sync_1 = __importDefault(require("walk-sync"));
44
- const fs = __importStar(require("fs"));
45
- class Registry {
46
- constructor(client) {
47
- this.client = client;
48
- this.modules = new discord_js_1.Collection();
49
- }
50
- get logger() {
51
- return this.client.logger.getChildLogger({
52
- name: 'Registry',
53
- });
54
- }
55
- get commands() {
56
- const result = [];
57
- for (const [, module] of this.modules) {
58
- result.push(...module.commands);
59
- }
60
- return result;
61
- }
62
- get argumentConverters() {
63
- const result = [];
64
- for (const [, module] of this.modules) {
65
- result.push(...module.argumentConverters);
66
- }
67
- return result;
68
- }
69
- get applicationCommandArgumentConverters() {
70
- const result = [];
71
- for (const [, module] of this.modules) {
72
- result.push(...module.applicationCommandArgumentConverters);
73
- }
74
- return result;
75
- }
76
- get applicationCommands() {
77
- const result = [];
78
- for (const [, module] of this.modules) {
79
- result.push(...module.applicationCommands);
80
- }
81
- return result;
82
- }
83
- get messageComponentHandlers() {
84
- const result = [];
85
- for (const [, module] of this.modules) {
86
- result.push(...module.messageComponentHandlers);
87
- }
88
- return result;
89
- }
90
- registerModule(module) {
91
- module.commandClient = this.client;
92
- this.modules.set(Symbol(module.constructor.name), module);
93
- const list = [];
94
- for (const listener of module.listeners) {
95
- const bound = listener.execute.bind(module);
96
- list.push({ event: listener.name, execute: bound });
97
- this.client.client.on(listener.name, bound);
98
- }
99
- Reflect.defineMetadata(constants_1.KListenerExecuteCache, list, module);
100
- return module;
101
- }
102
- loadModulesIn(dir, absolute = false) {
103
- return __awaiter(this, void 0, void 0, function* () {
104
- let p = absolute ? dir : path_1.default.join(require.main.path, dir);
105
- for (const i of walk_sync_1.default(p)) {
106
- if (fs.lstatSync(path_1.default.join(p, i)).isFile()) {
107
- if (i.endsWith('.map'))
108
- continue;
109
- yield this.loadModule(path_1.default.join(p, i), true);
110
- }
111
- }
112
- });
113
- }
114
- loadModule(file, absolute = false) {
115
- return __awaiter(this, void 0, void 0, function* () {
116
- let p = absolute ? file : path_1.default.join(require.main.path, file);
117
- let m;
118
- try {
119
- m = require(p);
120
- }
121
- catch (e) {
122
- throw new error_1.ModuleLoadError(p, e);
123
- }
124
- if (m.loaded)
125
- throw new Error('MODULE_ALREADY_LOADED');
126
- if (!m.install)
127
- throw new error_1.InvalidModuleError('Install function not found.');
128
- const mod = m.install(this.client);
129
- if (!(mod instanceof Module_1.Module))
130
- throw new error_1.InvalidTargetError();
131
- Reflect.defineMetadata(constants_1.KModulePath, require.resolve(p), mod);
132
- this.registerModule(mod);
133
- yield mod.load();
134
- m.loaded = true;
135
- return mod;
136
- });
137
- }
138
- syncCommands() {
139
- var _a;
140
- return __awaiter(this, void 0, void 0, function* () {
141
- this.logger.debug(`Syncing commands...`);
142
- const commands = this.applicationCommands.filter((x) => !x.guild);
143
- const guild = this.client.options.applicationCommands.guild;
144
- if (guild) {
145
- const syncForGuild = (g) => __awaiter(this, void 0, void 0, function* () {
146
- this.logger.debug(`Syncing for guild ${g.name}(${g.id})`);
147
- const commandsToRegister = [
148
- ...commands.map((x) => x.command),
149
- ...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),
150
- ];
151
- this.logger.debug(`Command List: ${commandsToRegister.map((x) => x.name).join(', ')}`);
152
- yield g.commands.set(commandsToRegister);
153
- });
154
- if (typeof guild === 'string') {
155
- yield syncForGuild(yield this.client.client.guilds.fetch(guild));
156
- }
157
- else {
158
- for (const g of guild) {
159
- yield syncForGuild(yield this.client.client.guilds.fetch(g));
160
- }
161
- }
162
- }
163
- else {
164
- this.logger.debug('Syncing global...');
165
- yield ((_a = this.client.client.application) === null || _a === void 0 ? void 0 : _a.commands.set(commands.map((x) => x.command)));
166
- }
167
- this.logger.debug('Syncing ended.');
168
- });
169
- }
170
- unregisterModule(module) {
171
- return __awaiter(this, void 0, void 0, function* () {
172
- if (Reflect.getMetadata(constants_1.KBuiltInModule, module))
173
- throw new Error('Built-in modules cannot be unloaded');
174
- const symbol = this.modules.findKey((x) => x === module);
175
- if (!symbol)
176
- return module;
177
- yield module.unload();
178
- const list = Reflect.getMetadata(constants_1.KListenerExecuteCache, module);
179
- for (const listener of list) {
180
- this.client.client.removeListener(listener.event, listener.execute);
181
- }
182
- this.modules.delete(symbol);
183
- return module;
184
- });
185
- }
186
- unloadModule(module) {
187
- return __awaiter(this, void 0, void 0, function* () {
188
- const p = Reflect.getMetadata(constants_1.KModulePath, module);
189
- if (!p)
190
- throw new error_1.InvalidModuleError('This module is not loaded by loadModule.');
191
- yield this.unregisterModule(module);
192
- delete require.cache[p];
193
- });
194
- }
195
- reloadModule(module) {
196
- return __awaiter(this, void 0, void 0, function* () {
197
- yield module.beforeReload();
198
- const p = Reflect.getMetadata(constants_1.KModulePath, module);
199
- yield this.unloadModule(module);
200
- const mod = yield this.loadModule(p, true);
201
- yield mod.afterReload();
202
- return true;
203
- });
204
- }
205
- reloadAll() {
206
- return __awaiter(this, void 0, void 0, function* () {
207
- const results = [];
208
- for (const [, module] of this.modules.filter((x) => !!x.path && !Reflect.getMetadata(constants_1.KBuiltInModule, x))) {
209
- try {
210
- yield this.reloadModule(module);
211
- results.push({
212
- path: module.path,
213
- success: true,
214
- });
215
- }
216
- catch (e) {
217
- results.push({
218
- error: e,
219
- path: module.path,
220
- success: false,
221
- });
222
- }
223
- }
224
- return results;
225
- });
226
- }
227
- }
228
- exports.Registry = Registry;
229
- //# sourceMappingURL=Registry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Registry.js","sourceRoot":"","sources":["../../src/structures/Registry.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,qCAAiC;AAEjC,4CAAiF;AACjF,gDAAuB;AACvB,oCAAkF;AAClF,2CAA8C;AAC9C,0DAAgC;AAGhC,uCAAwB;AAQxB,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,IAAI,CAAC,OAAO,EAAE;YACrC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;SAChC;QAED,OAAO,MAAM,CAAA;IACf,CAAC;IAED,IAAI,kBAAkB;QACpB,MAAM,MAAM,GAAwB,EAAE,CAAA;QAEtC,KAAK,MAAM,CAAC,EAAE,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE;YACrC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAA;SAC1C;QAED,OAAO,MAAM,CAAA;IACf,CAAC;IAED,IAAI,oCAAoC;QACtC,MAAM,MAAM,GAA0C,EAAE,CAAA;QAExD,KAAK,MAAM,CAAC,EAAE,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE;YACrC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,oCAAoC,CAAC,CAAA;SAC5D;QAED,OAAO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IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,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"}
@@ -1,3 +0,0 @@
1
- export * from './Module';
2
- export * from './CommandClient';
3
- export * from './Registry';
@@ -1,19 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2022 pikokr. Licensed under the MIT license
4
- */
5
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
8
- }) : (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- o[k2] = m[k];
11
- }));
12
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
13
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
14
- };
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- __exportStar(require("./Module"), exports);
17
- __exportStar(require("./CommandClient"), exports);
18
- __exportStar(require("./Registry"), exports);
19
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/structures/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;AAEH,2CAAwB;AACxB,kDAA+B;AAC/B,6CAA0B"}
package/dist/typings.d.ts DELETED
@@ -1,30 +0,0 @@
1
- import type { Command } from './command';
2
- import { CommandClient } from './structures';
3
- import { AppCommand } from './applicationCommand';
4
- declare module 'discord.js' {
5
- interface Message {
6
- data: {
7
- command: Command | null;
8
- prefix: string;
9
- cts: CommandClient;
10
- };
11
- }
12
- interface CommandInteraction {
13
- data: {
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;
27
- cts: CommandClient;
28
- };
29
- }
30
- }
package/dist/typings.js DELETED
@@ -1,6 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2022 pikokr. Licensed under the MIT license
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- //# sourceMappingURL=typings.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"typings.js","sourceRoot":"","sources":["../src/typings.ts"],"names":[],"mappings":";AAAA;;GAEG"}
package/dist/utils.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare const checkTarget: (target: Object) => void;
package/dist/utils.js DELETED
@@ -1,14 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2022 pikokr. Licensed under the MIT license
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.checkTarget = void 0;
7
- const structures_1 = require("./structures");
8
- const error_1 = require("./error");
9
- const checkTarget = (target) => {
10
- if (!(target instanceof structures_1.Module))
11
- throw new error_1.InvalidTargetError();
12
- };
13
- exports.checkTarget = checkTarget;
14
- //# sourceMappingURL=utils.js.map
package/dist/utils.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,6CAAqC;AACrC,mCAA4C;AAErC,MAAM,WAAW,GAAG,CAAC,MAAc,EAAE,EAAE;IAC5C,IAAI,CAAC,CAAC,MAAM,YAAY,mBAAM,CAAC;QAAE,MAAM,IAAI,0BAAkB,EAAE,CAAA;AACjE,CAAC,CAAA;AAFY,QAAA,WAAW,eAEvB"}