@pikokr/command.ts 5.2.1 → 5.3.0-dev.64b0ef9

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ # This file is automatically generated by @yarnpkg/sdks.
2
+ # Manual changes might be lost!
3
+
4
+ integrations:
5
+ - vscode
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+
3
+ const {existsSync} = require(`fs`);
4
+ const {createRequire, createRequireFromPath} = require(`module`);
5
+ const {resolve} = require(`path`);
6
+
7
+ const relPnpApiPath = "../../../.pnp.cjs";
8
+
9
+ const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10
+ const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
11
+
12
+ if (existsSync(absPnpApiPath)) {
13
+ if (!process.versions.pnp) {
14
+ // Setup the environment to be able to require prettier/index.js
15
+ require(absPnpApiPath).setup();
16
+ }
17
+ }
18
+
19
+ // Defer to the real prettier/index.js your application uses
20
+ module.exports = absRequire(`prettier/index.js`);
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "prettier",
3
+ "version": "2.7.1-sdk",
4
+ "main": "./index.js",
5
+ "type": "commonjs"
6
+ }
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+
3
+ const {existsSync} = require(`fs`);
4
+ const {createRequire, createRequireFromPath} = require(`module`);
5
+ const {resolve} = require(`path`);
6
+
7
+ const relPnpApiPath = "../../../../.pnp.cjs";
8
+
9
+ const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10
+ const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
11
+
12
+ if (existsSync(absPnpApiPath)) {
13
+ if (!process.versions.pnp) {
14
+ // Setup the environment to be able to require typescript/bin/tsc
15
+ require(absPnpApiPath).setup();
16
+ }
17
+ }
18
+
19
+ // Defer to the real typescript/bin/tsc your application uses
20
+ module.exports = absRequire(`typescript/bin/tsc`);
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+
3
+ const {existsSync} = require(`fs`);
4
+ const {createRequire, createRequireFromPath} = require(`module`);
5
+ const {resolve} = require(`path`);
6
+
7
+ const relPnpApiPath = "../../../../.pnp.cjs";
8
+
9
+ const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10
+ const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
11
+
12
+ if (existsSync(absPnpApiPath)) {
13
+ if (!process.versions.pnp) {
14
+ // Setup the environment to be able to require typescript/bin/tsserver
15
+ require(absPnpApiPath).setup();
16
+ }
17
+ }
18
+
19
+ // Defer to the real typescript/bin/tsserver your application uses
20
+ module.exports = absRequire(`typescript/bin/tsserver`);
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+
3
+ const {existsSync} = require(`fs`);
4
+ const {createRequire, createRequireFromPath} = require(`module`);
5
+ const {resolve} = require(`path`);
6
+
7
+ const relPnpApiPath = "../../../../.pnp.cjs";
8
+
9
+ const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10
+ const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
11
+
12
+ if (existsSync(absPnpApiPath)) {
13
+ if (!process.versions.pnp) {
14
+ // Setup the environment to be able to require typescript/lib/tsc.js
15
+ require(absPnpApiPath).setup();
16
+ }
17
+ }
18
+
19
+ // Defer to the real typescript/lib/tsc.js your application uses
20
+ module.exports = absRequire(`typescript/lib/tsc.js`);
@@ -0,0 +1,196 @@
1
+ #!/usr/bin/env node
2
+
3
+ const {existsSync} = require(`fs`);
4
+ const {createRequire, createRequireFromPath} = require(`module`);
5
+ const {resolve} = require(`path`);
6
+
7
+ const relPnpApiPath = "../../../../.pnp.cjs";
8
+
9
+ const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10
+ const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
11
+
12
+ const moduleWrapper = tsserver => {
13
+ if (!process.versions.pnp) {
14
+ return tsserver;
15
+ }
16
+
17
+ const {isAbsolute} = require(`path`);
18
+ const pnpApi = require(`pnpapi`);
19
+
20
+ const isVirtual = str => str.match(/\/(\$\$virtual|__virtual__)\//);
21
+ const isPortal = str => str.startsWith("portal:/");
22
+ const normalize = str => str.replace(/\\/g, `/`).replace(/^\/?/, `/`);
23
+
24
+ const dependencyTreeRoots = new Set(pnpApi.getDependencyTreeRoots().map(locator => {
25
+ return `${locator.name}@${locator.reference}`;
26
+ }));
27
+
28
+ // VSCode sends the zip paths to TS using the "zip://" prefix, that TS
29
+ // doesn't understand. This layer makes sure to remove the protocol
30
+ // before forwarding it to TS, and to add it back on all returned paths.
31
+
32
+ function toEditorPath(str) {
33
+ // We add the `zip:` prefix to both `.zip/` paths and virtual paths
34
+ if (isAbsolute(str) && !str.match(/^\^?(zip:|\/zip\/)/) && (str.match(/\.zip\//) || isVirtual(str))) {
35
+ // We also take the opportunity to turn virtual paths into physical ones;
36
+ // this makes it much easier to work with workspaces that list peer
37
+ // dependencies, since otherwise Ctrl+Click would bring us to the virtual
38
+ // file instances instead of the real ones.
39
+ //
40
+ // We only do this to modules owned by the the dependency tree roots.
41
+ // This avoids breaking the resolution when jumping inside a vendor
42
+ // with peer dep (otherwise jumping into react-dom would show resolution
43
+ // errors on react).
44
+ //
45
+ const resolved = isVirtual(str) ? pnpApi.resolveVirtual(str) : str;
46
+ if (resolved) {
47
+ const locator = pnpApi.findPackageLocator(resolved);
48
+ if (locator && (dependencyTreeRoots.has(`${locator.name}@${locator.reference}`) || isPortal(locator.reference))) {
49
+ str = resolved;
50
+ }
51
+ }
52
+
53
+ str = normalize(str);
54
+
55
+ if (str.match(/\.zip\//)) {
56
+ switch (hostInfo) {
57
+ // Absolute VSCode `Uri.fsPath`s need to start with a slash.
58
+ // VSCode only adds it automatically for supported schemes,
59
+ // so we have to do it manually for the `zip` scheme.
60
+ // The path needs to start with a caret otherwise VSCode doesn't handle the protocol
61
+ //
62
+ // Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
63
+ //
64
+ // Update Oct 8 2021: VSCode changed their format in 1.61.
65
+ // Before | ^zip:/c:/foo/bar.zip/package.json
66
+ // After | ^/zip//c:/foo/bar.zip/package.json
67
+ //
68
+ case `vscode <1.61`: {
69
+ str = `^zip:${str}`;
70
+ } break;
71
+
72
+ case `vscode`: {
73
+ str = `^/zip/${str}`;
74
+ } break;
75
+
76
+ // To make "go to definition" work,
77
+ // We have to resolve the actual file system path from virtual path
78
+ // and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip)
79
+ case `coc-nvim`: {
80
+ str = normalize(resolved).replace(/\.zip\//, `.zip::`);
81
+ str = resolve(`zipfile:${str}`);
82
+ } break;
83
+
84
+ // Support neovim native LSP and [typescript-language-server](https://github.com/theia-ide/typescript-language-server)
85
+ // We have to resolve the actual file system path from virtual path,
86
+ // everything else is up to neovim
87
+ case `neovim`: {
88
+ str = normalize(resolved).replace(/\.zip\//, `.zip::`);
89
+ str = `zipfile://${str}`;
90
+ } break;
91
+
92
+ default: {
93
+ str = `zip:${str}`;
94
+ } break;
95
+ }
96
+ }
97
+ }
98
+
99
+ return str;
100
+ }
101
+
102
+ function fromEditorPath(str) {
103
+ switch (hostInfo) {
104
+ case `coc-nvim`: {
105
+ str = str.replace(/\.zip::/, `.zip/`);
106
+ // The path for coc-nvim is in format of /<pwd>/zipfile:/<pwd>/.yarn/...
107
+ // So in order to convert it back, we use .* to match all the thing
108
+ // before `zipfile:`
109
+ return process.platform === `win32`
110
+ ? str.replace(/^.*zipfile:\//, ``)
111
+ : str.replace(/^.*zipfile:/, ``);
112
+ } break;
113
+
114
+ case `neovim`: {
115
+ str = str.replace(/\.zip::/, `.zip/`);
116
+ // The path for neovim is in format of zipfile:///<pwd>/.yarn/...
117
+ return str.replace(/^zipfile:\/\//, ``);
118
+ } break;
119
+
120
+ case `vscode`:
121
+ default: {
122
+ return process.platform === `win32`
123
+ ? str.replace(/^\^?(zip:|\/zip)\/+/, ``)
124
+ : str.replace(/^\^?(zip:|\/zip)\/+/, `/`);
125
+ } break;
126
+ }
127
+ }
128
+
129
+ // Force enable 'allowLocalPluginLoads'
130
+ // TypeScript tries to resolve plugins using a path relative to itself
131
+ // which doesn't work when using the global cache
132
+ // https://github.com/microsoft/TypeScript/blob/1b57a0395e0bff191581c9606aab92832001de62/src/server/project.ts#L2238
133
+ // VSCode doesn't want to enable 'allowLocalPluginLoads' due to security concerns but
134
+ // TypeScript already does local loads and if this code is running the user trusts the workspace
135
+ // https://github.com/microsoft/vscode/issues/45856
136
+ const ConfiguredProject = tsserver.server.ConfiguredProject;
137
+ const {enablePluginsWithOptions: originalEnablePluginsWithOptions} = ConfiguredProject.prototype;
138
+ ConfiguredProject.prototype.enablePluginsWithOptions = function() {
139
+ this.projectService.allowLocalPluginLoads = true;
140
+ return originalEnablePluginsWithOptions.apply(this, arguments);
141
+ };
142
+
143
+ // And here is the point where we hijack the VSCode <-> TS communications
144
+ // by adding ourselves in the middle. We locate everything that looks
145
+ // like an absolute path of ours and normalize it.
146
+
147
+ const Session = tsserver.server.Session;
148
+ const {onMessage: originalOnMessage, send: originalSend} = Session.prototype;
149
+ let hostInfo = `unknown`;
150
+
151
+ Object.assign(Session.prototype, {
152
+ onMessage(/** @type {string | object} */ message) {
153
+ const isStringMessage = typeof message === 'string';
154
+ const parsedMessage = isStringMessage ? JSON.parse(message) : message;
155
+
156
+ if (
157
+ parsedMessage != null &&
158
+ typeof parsedMessage === `object` &&
159
+ parsedMessage.arguments &&
160
+ typeof parsedMessage.arguments.hostInfo === `string`
161
+ ) {
162
+ hostInfo = parsedMessage.arguments.hostInfo;
163
+ if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK && process.env.VSCODE_IPC_HOOK.match(/Code\/1\.([1-5][0-9]|60)\./)) {
164
+ hostInfo += ` <1.61`;
165
+ }
166
+ }
167
+
168
+ const processedMessageJSON = JSON.stringify(parsedMessage, (key, value) => {
169
+ return typeof value === 'string' ? fromEditorPath(value) : value;
170
+ });
171
+
172
+ return originalOnMessage.call(
173
+ this,
174
+ isStringMessage ? processedMessageJSON : JSON.parse(processedMessageJSON)
175
+ );
176
+ },
177
+
178
+ send(/** @type {any} */ msg) {
179
+ return originalSend.call(this, JSON.parse(JSON.stringify(msg, (key, value) => {
180
+ return typeof value === `string` ? toEditorPath(value) : value;
181
+ })));
182
+ }
183
+ });
184
+
185
+ return tsserver;
186
+ };
187
+
188
+ if (existsSync(absPnpApiPath)) {
189
+ if (!process.versions.pnp) {
190
+ // Setup the environment to be able to require typescript/lib/tsserver.js
191
+ require(absPnpApiPath).setup();
192
+ }
193
+ }
194
+
195
+ // Defer to the real typescript/lib/tsserver.js your application uses
196
+ module.exports = moduleWrapper(absRequire(`typescript/lib/tsserver.js`));
@@ -0,0 +1,196 @@
1
+ #!/usr/bin/env node
2
+
3
+ const {existsSync} = require(`fs`);
4
+ const {createRequire, createRequireFromPath} = require(`module`);
5
+ const {resolve} = require(`path`);
6
+
7
+ const relPnpApiPath = "../../../../.pnp.cjs";
8
+
9
+ const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10
+ const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
11
+
12
+ const moduleWrapper = tsserver => {
13
+ if (!process.versions.pnp) {
14
+ return tsserver;
15
+ }
16
+
17
+ const {isAbsolute} = require(`path`);
18
+ const pnpApi = require(`pnpapi`);
19
+
20
+ const isVirtual = str => str.match(/\/(\$\$virtual|__virtual__)\//);
21
+ const isPortal = str => str.startsWith("portal:/");
22
+ const normalize = str => str.replace(/\\/g, `/`).replace(/^\/?/, `/`);
23
+
24
+ const dependencyTreeRoots = new Set(pnpApi.getDependencyTreeRoots().map(locator => {
25
+ return `${locator.name}@${locator.reference}`;
26
+ }));
27
+
28
+ // VSCode sends the zip paths to TS using the "zip://" prefix, that TS
29
+ // doesn't understand. This layer makes sure to remove the protocol
30
+ // before forwarding it to TS, and to add it back on all returned paths.
31
+
32
+ function toEditorPath(str) {
33
+ // We add the `zip:` prefix to both `.zip/` paths and virtual paths
34
+ if (isAbsolute(str) && !str.match(/^\^?(zip:|\/zip\/)/) && (str.match(/\.zip\//) || isVirtual(str))) {
35
+ // We also take the opportunity to turn virtual paths into physical ones;
36
+ // this makes it much easier to work with workspaces that list peer
37
+ // dependencies, since otherwise Ctrl+Click would bring us to the virtual
38
+ // file instances instead of the real ones.
39
+ //
40
+ // We only do this to modules owned by the the dependency tree roots.
41
+ // This avoids breaking the resolution when jumping inside a vendor
42
+ // with peer dep (otherwise jumping into react-dom would show resolution
43
+ // errors on react).
44
+ //
45
+ const resolved = isVirtual(str) ? pnpApi.resolveVirtual(str) : str;
46
+ if (resolved) {
47
+ const locator = pnpApi.findPackageLocator(resolved);
48
+ if (locator && (dependencyTreeRoots.has(`${locator.name}@${locator.reference}`) || isPortal(locator.reference))) {
49
+ str = resolved;
50
+ }
51
+ }
52
+
53
+ str = normalize(str);
54
+
55
+ if (str.match(/\.zip\//)) {
56
+ switch (hostInfo) {
57
+ // Absolute VSCode `Uri.fsPath`s need to start with a slash.
58
+ // VSCode only adds it automatically for supported schemes,
59
+ // so we have to do it manually for the `zip` scheme.
60
+ // The path needs to start with a caret otherwise VSCode doesn't handle the protocol
61
+ //
62
+ // Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
63
+ //
64
+ // Update Oct 8 2021: VSCode changed their format in 1.61.
65
+ // Before | ^zip:/c:/foo/bar.zip/package.json
66
+ // After | ^/zip//c:/foo/bar.zip/package.json
67
+ //
68
+ case `vscode <1.61`: {
69
+ str = `^zip:${str}`;
70
+ } break;
71
+
72
+ case `vscode`: {
73
+ str = `^/zip/${str}`;
74
+ } break;
75
+
76
+ // To make "go to definition" work,
77
+ // We have to resolve the actual file system path from virtual path
78
+ // and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip)
79
+ case `coc-nvim`: {
80
+ str = normalize(resolved).replace(/\.zip\//, `.zip::`);
81
+ str = resolve(`zipfile:${str}`);
82
+ } break;
83
+
84
+ // Support neovim native LSP and [typescript-language-server](https://github.com/theia-ide/typescript-language-server)
85
+ // We have to resolve the actual file system path from virtual path,
86
+ // everything else is up to neovim
87
+ case `neovim`: {
88
+ str = normalize(resolved).replace(/\.zip\//, `.zip::`);
89
+ str = `zipfile://${str}`;
90
+ } break;
91
+
92
+ default: {
93
+ str = `zip:${str}`;
94
+ } break;
95
+ }
96
+ }
97
+ }
98
+
99
+ return str;
100
+ }
101
+
102
+ function fromEditorPath(str) {
103
+ switch (hostInfo) {
104
+ case `coc-nvim`: {
105
+ str = str.replace(/\.zip::/, `.zip/`);
106
+ // The path for coc-nvim is in format of /<pwd>/zipfile:/<pwd>/.yarn/...
107
+ // So in order to convert it back, we use .* to match all the thing
108
+ // before `zipfile:`
109
+ return process.platform === `win32`
110
+ ? str.replace(/^.*zipfile:\//, ``)
111
+ : str.replace(/^.*zipfile:/, ``);
112
+ } break;
113
+
114
+ case `neovim`: {
115
+ str = str.replace(/\.zip::/, `.zip/`);
116
+ // The path for neovim is in format of zipfile:///<pwd>/.yarn/...
117
+ return str.replace(/^zipfile:\/\//, ``);
118
+ } break;
119
+
120
+ case `vscode`:
121
+ default: {
122
+ return process.platform === `win32`
123
+ ? str.replace(/^\^?(zip:|\/zip)\/+/, ``)
124
+ : str.replace(/^\^?(zip:|\/zip)\/+/, `/`);
125
+ } break;
126
+ }
127
+ }
128
+
129
+ // Force enable 'allowLocalPluginLoads'
130
+ // TypeScript tries to resolve plugins using a path relative to itself
131
+ // which doesn't work when using the global cache
132
+ // https://github.com/microsoft/TypeScript/blob/1b57a0395e0bff191581c9606aab92832001de62/src/server/project.ts#L2238
133
+ // VSCode doesn't want to enable 'allowLocalPluginLoads' due to security concerns but
134
+ // TypeScript already does local loads and if this code is running the user trusts the workspace
135
+ // https://github.com/microsoft/vscode/issues/45856
136
+ const ConfiguredProject = tsserver.server.ConfiguredProject;
137
+ const {enablePluginsWithOptions: originalEnablePluginsWithOptions} = ConfiguredProject.prototype;
138
+ ConfiguredProject.prototype.enablePluginsWithOptions = function() {
139
+ this.projectService.allowLocalPluginLoads = true;
140
+ return originalEnablePluginsWithOptions.apply(this, arguments);
141
+ };
142
+
143
+ // And here is the point where we hijack the VSCode <-> TS communications
144
+ // by adding ourselves in the middle. We locate everything that looks
145
+ // like an absolute path of ours and normalize it.
146
+
147
+ const Session = tsserver.server.Session;
148
+ const {onMessage: originalOnMessage, send: originalSend} = Session.prototype;
149
+ let hostInfo = `unknown`;
150
+
151
+ Object.assign(Session.prototype, {
152
+ onMessage(/** @type {string | object} */ message) {
153
+ const isStringMessage = typeof message === 'string';
154
+ const parsedMessage = isStringMessage ? JSON.parse(message) : message;
155
+
156
+ if (
157
+ parsedMessage != null &&
158
+ typeof parsedMessage === `object` &&
159
+ parsedMessage.arguments &&
160
+ typeof parsedMessage.arguments.hostInfo === `string`
161
+ ) {
162
+ hostInfo = parsedMessage.arguments.hostInfo;
163
+ if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK && process.env.VSCODE_IPC_HOOK.match(/Code\/1\.([1-5][0-9]|60)\./)) {
164
+ hostInfo += ` <1.61`;
165
+ }
166
+ }
167
+
168
+ const processedMessageJSON = JSON.stringify(parsedMessage, (key, value) => {
169
+ return typeof value === 'string' ? fromEditorPath(value) : value;
170
+ });
171
+
172
+ return originalOnMessage.call(
173
+ this,
174
+ isStringMessage ? processedMessageJSON : JSON.parse(processedMessageJSON)
175
+ );
176
+ },
177
+
178
+ send(/** @type {any} */ msg) {
179
+ return originalSend.call(this, JSON.parse(JSON.stringify(msg, (key, value) => {
180
+ return typeof value === `string` ? toEditorPath(value) : value;
181
+ })));
182
+ }
183
+ });
184
+
185
+ return tsserver;
186
+ };
187
+
188
+ if (existsSync(absPnpApiPath)) {
189
+ if (!process.versions.pnp) {
190
+ // Setup the environment to be able to require typescript/lib/tsserverlibrary.js
191
+ require(absPnpApiPath).setup();
192
+ }
193
+ }
194
+
195
+ // Defer to the real typescript/lib/tsserverlibrary.js your application uses
196
+ module.exports = moduleWrapper(absRequire(`typescript/lib/tsserverlibrary.js`));
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+
3
+ const {existsSync} = require(`fs`);
4
+ const {createRequire, createRequireFromPath} = require(`module`);
5
+ const {resolve} = require(`path`);
6
+
7
+ const relPnpApiPath = "../../../../.pnp.cjs";
8
+
9
+ const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10
+ const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
11
+
12
+ if (existsSync(absPnpApiPath)) {
13
+ if (!process.versions.pnp) {
14
+ // Setup the environment to be able to require typescript/lib/typescript.js
15
+ require(absPnpApiPath).setup();
16
+ }
17
+ }
18
+
19
+ // Defer to the real typescript/lib/typescript.js your application uses
20
+ module.exports = absRequire(`typescript/lib/typescript.js`);
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "typescript",
3
+ "version": "4.8.2-sdk",
4
+ "main": "./lib/typescript.js",
5
+ "type": "commonjs"
6
+ }
package/.yarnrc.yml ADDED
@@ -0,0 +1 @@
1
+ yarnPath: .yarn/releases/yarn-3.2.3.cjs
package/dist/index.d.ts CHANGED
@@ -205,4 +205,4 @@ declare const applicationCommand: (options: Options) => MethodDecorator;
205
205
 
206
206
  declare const option: (options: APIApplicationCommandOption) => ParameterDecorator;
207
207
 
208
- export { ApplicationCommandComponent, Options as ApplicationCommandComponentOptions, BaseComponent, CommandClient, ComponentArgument, ComponentArgumentDecorator, ComponentHookStore, ConverterComponent, Extension, ListenerComponent, OwnerOnlyError, Registry, SubCommandGroup, SubCommandGroupChild, TextCommandComponent, TextCommandConfig, TextCommandRestOption, applicationCommand, argConverter, command, createArgumentDecorator, createCheckDecorator, createComponentDecorator, createComponentHook, getComponent, getComponentArgumentStore, getComponentStore, getModuleHookStore, listener, mergeMethodDecorators, moduleHook, option, ownerOnly, rest };
208
+ export { ApplicationCommandComponent, Options as ApplicationCommandComponentOptions, ApplicationCommandExtension, ApplicationCommandExtensionConfig, Options$2 as ArgumentConvertOptions, OptionsArg$1 as ArgumentConvertOptionsArg, BaseComponent, CommandClient, ComponentArgument, ComponentArgumentDecorator, ComponentArgumentStore, ComponentHookFn, ComponentHookStore, ComponentStore, ConverterComponent, Extension, ListenerComponent, Options$1 as ListenerOptions, OptionsArg as ListenerOptionsArg, ModuleHookStore, OwnerOnlyError, Registry, SubCommandGroup, SubCommandGroupChild, TextCommandComponent, TextCommandConfig, TextCommandOptions, TextCommandRestOption, applicationCommand, argConverter, command, createArgumentDecorator, createCheckDecorator, createComponentDecorator, createComponentHook, getComponent, getComponentArgumentStore, getComponentStore, getModuleHookStore, listener, mergeMethodDecorators, moduleHook, option, ownerOnly, rest };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var ne=Object.create;var B=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var ie=Object.getPrototypeOf,ae=Object.prototype.hasOwnProperty;var a=(n,t)=>B(n,"name",{value:t,configurable:!0});var f=(n,t)=>()=>(n&&(t=n(n=0)),t);var Gt=(n,t)=>{for(var e in t)B(n,e,{get:t[e],enumerable:!0})},Ft=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of se(t))!ae.call(n,s)&&s!==e&&B(n,s,{get:()=>t[s],enumerable:!(o=re(t,s))||o.enumerable});return n};var b=(n,t,e)=>(e=n!=null?ne(ie(n)):{},Ft(t||!n||!n.__esModule?B(e,"default",{value:n,enumerable:!0}):e,n)),ce=n=>Ft(B({},"__esModule",{value:!0}),n);var z,xe,ft,Y,ut,tt,O=f(()=>{"use strict";z=Symbol(),xe=Symbol(),ft=Symbol(),Y=Symbol(),ut=Symbol(),tt=Symbol()});var jt,dt,et,gt=f(()=>{"use strict";jt=require("discord.js");O();dt=a((n,t)=>{let e=Reflect.getMetadata(ut,n,t);return e||(e=new jt.Collection,Reflect.defineMetadata(ut,e,n,t)),e},"getComponentHookStore"),et=a((n,t)=>(e,o)=>{let s=dt(e,o),r=s.get(n);r||(r=[],s.set(n,r)),r.unshift(t)},"createComponentHook")});var ht,Z,me,y,yt,J,$=f(()=>{"use strict";ht=require("discord.js");gt();O();Z=a(n=>{let t=Reflect.getMetadata(z,n);return t||(t=new ht.Collection,Reflect.defineMetadata(z,t,n)),t},"getComponentStore"),me=a((n,t)=>Z(n).get(t),"getComponent"),y=a(n=>(t,e)=>{n._init(Reflect.get(t,e),Reflect.getMetadata("design:paramtypes",t,e));let o=dt(t,e);n.hooks=o;let s=Z(t);yt(t,e).forEach((c,i)=>{var m;(m=n.argTypes.get(i))==null||m.decorators.push(c)}),s.set(e,n)},"createComponentDecorator"),yt=a((n,t)=>{let e=Reflect.getMetadata(z,n,t);return e||(e=new ht.Collection,Reflect.defineMetadata(z,e,n,t)),e},"getComponentArgumentStore"),J=a(n=>t=>(e,o,s)=>{var r=new n(t);yt(e,o).set(s,r)},"createArgumentDecorator")});var A,xt=f(()=>{"use strict";A=class{constructor(t){this.type=t,this.decorators=[]}};a(A,"ComponentArgument")});var Et,H,Lt=f(()=>{"use strict";Et=b(require("lodash")),H=class{constructor(t){typeof t=="object"?this.options=Et.default.merge(this.defaultOptions(),t):this.options=t}defaultOptions(){return{}}};a(H,"ComponentArgumentDecorator")});var h,pe,ot=f(()=>{"use strict";$();W();h=class extends x{constructor(t){super(),this.options=t}};a(h,"ApplicationCommandComponent");pe=a(n=>y(new h(n)),"applicationCommand")});var R,Ot,bt=f(()=>{"use strict";G();R=class extends H{};a(R,"ApplicationCommandOption");Ot=J(R)});var $t,T,K,Q=f(()=>{"use strict";$t=b(require("lodash"));W();$();T=class extends x{constructor(t){super(),this.options=$t.default.merge({emitter:"discord"},t)}};a(T,"ListenerComponent");K=a(n=>y(new T(n)),"listener")});var F,M,nt=f(()=>{"use strict";W();$();F=class extends x{constructor(t){super(),this.options=t}};a(F,"ConverterComponent");M=a(n=>y(new F(n)),"argConverter")});var At,rt,le,Wt=f(()=>{"use strict";At=require("discord.js");O();rt=a(n=>{let t=Reflect.getMetadata(ft,n);return t||(t=new At.Collection,Reflect.defineMetadata(ft,t,n)),t},"getModuleHookStore"),le=a(n=>(t,e)=>{let o=rt(t),s=o.get(n);s||(s=[],o.set(n,s)),s.push(Reflect.get(t,e))},"moduleHook")});var st=f(()=>{"use strict";Wt();gt()});var D,Dt,Pt,Nt,qt,P,Ct=f(()=>{"use strict";D=b(require("chalk")),Dt=require("discord.js"),Pt=b(require("lodash"));wt();st();Q();O();Nt=b(require("walk-sync")),qt=b(require("path")),P=class{constructor(t,e){this.client=e,this.extensions=[],this.emitters=new Dt.Collection,this.globalHooks={},this.logger=t.getChildLogger({prefix:[D.default.green("[Registry]")]})}addGlobalHook(t,e){let o=this.globalHooks[t];o||(o=[],this.globalHooks[t]=o),o.push(e)}getComponentsWithTypeGlobal(t){let e=[];for(let o of this.extensions)e.push(...this.getComponentsWithType(o,t));return e}getComponentsWithType(t,e){let o=Z(t);return Array.from(o.filter(s=>s.constructor===e).values())}registerEventListeners(t){let e=this.getComponentsWithType(t,T);for(let o of e){let s=this.emitters.get(o.options.emitter);if(s){let r=o.method.bind(t);Reflect.defineMetadata("bound",r,o),s.addListener(o.options.event,r)}}}unregisterEventListeners(t){let e=this.getComponentsWithType(t,T);for(let o of e){let s=this.emitters.get(o.options.emitter),r=Reflect.getMetadata("bound",o);s&&r&&s.removeListener(o.options.event,r)}}async loadAllModulesInDirectory(t){let e=[],o=(0,Nt.default)(t).filter(s=>s.endsWith(".ts")||s.endsWith(".js"));for(let s of o){if(s.endsWith(".d.ts"))continue;let r=qt.default.join(t,s);e.push(...await this.loadModulesAtPath(r))}return e}async loadModulesAtPath(t){this.logger.info(`Loading module at path ${D.default.green(t)}`);let e=require.resolve(t),o=require(e);if(typeof o.setup!="function")throw new Error("Extension must have a setup function");let s=await o.setup(this.client);return this.registerModules(s,e)}async registerModules(t,e){let o=[];if(t instanceof Array)for(let s of t)await this.registerModule(s),Reflect.defineMetadata(tt,e,s),o.push(s);else await this.registerModule(t),Reflect.defineMetadata(tt,e,t),o.push(t);return o}async reloadModules(){let t=[],e=new Set,o=[...this.extensions];for(let s of o){let r=Reflect.getMetadata(tt,s);!r||(this.logger.info(`Unloading module: ${D.default.green(s.constructor.name)}`),e.add(r),await this.unregisterModule(s),delete require.cache[require.resolve(r)])}for(let s of e)try{let r=await this.loadModulesAtPath(s);t.push({file:s,result:!0,extensions:r})}catch(r){t.push({file:s,result:!1,error:r})}return t}async registerModule(t){Reflect.defineMetadata(Y,this.client,t),this.registerEventListeners(t),await this.runModuleHook(t,"load"),this.extensions.push(t),this.logger.info(`Module registered: ${D.default.green(t.constructor.name)}`)}async unregisterModule(t){this.unregisterEventListeners(t),await this.runModuleHook(t,"unload"),Pt.default.remove(this.extensions,e=>e===t),this.logger.info(`Module unregistered: ${D.default.green(t.constructor.name)}`)}runModuleHook(t,e,...o){let r=rt(t).get(e);if(r)for(let c of r)c.call(t,...o)}registerEventEmitter(t,e){this.emitters.set(t,e)}};a(P,"Registry")});var Mt=f(()=>{"use strict";Ct();St()});var Ut,Bt,N,vt=f(()=>{"use strict";Ut=b(require("chalk")),Bt=require("discord.js");nt();Mt();N=class{get commandClient(){return j.getFromModule(this)}get client(){return this.commandClient.discord}get logger(){return this._logger||(this._logger=this.commandClient.logger.getChildLogger({prefix:[Ut.default.green(`[${this.constructor.name}]`)],displayFunctionName:!1})),this._logger}async convertArguments(t,e,o,s){let r=new Bt.Collection;for(let c of this.commandClient.registry.extensions)for(let i of this.commandClient.registry.getComponentsWithType(c,F))i.options.component==t&&r.set(i.options.type,{component:i,ext:c});for(let[c,i]of o){let m=r.get(i.type);if(!m){e[c]=void 0;continue}let u=await s(i,c,m.component);e[c]=await m.component.execute(m.ext,u)}}};a(N,"Extension")});var zt,E,kt=f(()=>{"use strict";zt=b(require("chalk"));vt();E=class extends N{get logger(){return this._logger||(this._logger=this.commandClient.ctsLogger.getChildLogger({prefix:[zt.default.green(`[${this.constructor.name}]`)],displayFunctionName:!1})),this._logger}};a(E,"CTSExtension")});var S,p,V,v,C,Zt=f(()=>{"use strict";S=b(require("chalk")),p=require("discord.js");ot();bt();Q();nt();kt();V=function(n,t,e,o){var s=arguments.length,r=s<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,o);else for(var i=n.length-1;i>=0;i--)(c=n[i])&&(r=(s<3?c(r):s>3?c(t,e,r):c(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},v=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},C=class extends E{constructor(t){super(),this.config=t,this.unmanagedCommands=[]}registerUnmanagedCommand(t){this.unmanagedCommands.push(t)}async interactionCreate(t){var e;try{if(t.type!==p.InteractionType.ApplicationCommand)return;let o=null,s=null,r=this.commandClient.registry.extensions,c=null,i=null;t.commandType===p.ApplicationCommandType.ChatInput&&(c=t.options.getSubcommand(!1),i=t.options.getSubcommandGroup(!1));t:for(let m of r){let u=this.commandClient.registry.getComponentsWithType(m,h);if(c){for(let l of u)if(!(!l.subcommandGroup&&!l.subcommandGroupChild)){if(l.subcommandGroupChild&&l.subcommandGroupChild.parent.options.name===t.commandName&&l.subcommandGroupChild.options.name===i&&l.options.name===c){s=m,o=l;break t}if(l.subcommandGroup&&!i&&l.subcommandGroup.options.name===t.commandName&&l.options.name===c){s=m,o=l;break t}}}else for(let l of u)if(l.options.name===t.commandName){s=m,o=l;break t}}if(o&&s){let m=[];await this.convertArguments(h,m,o.argTypes,()=>[t]);for(let[u,l]of o.argTypes){let d=null;for(let g of l.decorators)if(g instanceof R){if([p.ApplicationCommandOptionType.Subcommand,p.ApplicationCommandOptionType.SubcommandGroup].includes(g.options.type)&&t.isChatInputCommand()){if(g.options.type===p.ApplicationCommandOptionType.Subcommand){d=t.options.getSubcommand()===g.options.name;break}if(g.options.type===p.ApplicationCommandOptionType.SubcommandGroup){d=t.options.getSubcommandGroup()===g.options.name;break}}d=(e=t.options.get(g.options.name,!1))==null?void 0:e.value;break}d&&(m[u]=d)}await o.execute(s,m,[t])}}catch(o){this.commandClient.emit("applicationCommandInvokeError",o,t)}}async sync(){let t=this.commandClient;this.logger.info("Trying to sync commands...");let e=[],o=new p.Collection,s=new p.Collection;for(let r of t.registry.getComponentsWithTypeGlobal(h)){if(r.subcommandGroup){let i=s.get(r.subcommandGroup.options.name);if(!i){if(i={...r.subcommandGroup.options,type:p.ApplicationCommandType.ChatInput},r.subcommandGroup.guilds)for(let u of r.subcommandGroup.guilds){let l=o.get(u);l||(l=[],o.set(u,l))}else e.push(i);s.set(r.subcommandGroup.options.name,i)}i.options||(i.options=[]);let m=[];for(let[,u]of r.argTypes){let l=u.decorators.find(d=>d.constructor===R);l&&m.push(l.options)}i.options.push({...r.options,type:p.ApplicationCommandOptionType.Subcommand,options:m});continue}else if(r.subcommandGroupChild){let i=r.subcommandGroupChild.parent,m=s.get(i.options.name);if(!m){if(m={...i.options,type:p.ApplicationCommandType.ChatInput},i.guilds)for(let d of i.guilds){let g=o.get(d);g||(g=[],o.set(d,g))}else e.push(m);s.set(i.options.name,m)}m.options||(m.options=[]);let u=m.options.find(d=>d.name===r.subcommandGroupChild.options.name);u||(u={type:p.ApplicationCommandOptionType.SubcommandGroup,...r.subcommandGroupChild.options},m.options.push(u)),u.options||(u.options=[]);let l=[];for(let[,d]of r.argTypes){let g=d.decorators.find(k=>k.constructor===R);g&&l.push(g.options)}u.options.push({...r.options,type:p.ApplicationCommandOptionType.Subcommand,options:l});continue}let c={...r.options};if(c.type===p.ApplicationCommandType.ChatInput){c.options=[];for(let[,i]of r.argTypes){let m=i.decorators.find(u=>u.constructor===R);m&&c.options.push(m.options)}}if(await r.executeHook(this,"beforeSync",[c,r]),r.options.guilds){for(let i of r.options.guilds){let m=o.get(i);m||(m=[],o.set(i,m)),m.push(c)}continue}e.push(c)}for(let{guilds:r,...c}of this.unmanagedCommands)if(r){for(let i of r){let m=o.get(i);m||(m=[],o.set(i,m)),m.push(c)}continue}else e.push(c);if(this.config.guilds){for(let r of this.config.guilds){let c=o.get(r);c||(c=[],o.set(r,c)),c.push(...e)}e=[]}if(o.size)for(let[r,c]of o)try{let i=await this.client.guilds.fetch(r);await i.fetch(),this.logger.info(`Processing ${S.default.green(c.length)} commands(${c.map(m=>S.default.blue(m.name)).join(", ")}) for guild ${S.default.green(i.name)}(${S.default.blue(i.id)})`),await i.commands.set(c),this.logger.info(`Successfully registered commands for guild ${S.default.green(i.name)}(${S.default.blue(i.id)})`)}catch(i){this.logger.error(`Failed to register commands to guild ${S.default.green(r)}: ${i.message}`)}if(e.length)try{this.logger.info(`Processing ${S.default.green(e.length)} commands(${e.map(r=>S.default.blue(r.name)).join(", ")}) for application scope...`),await this.client.application.commands.set(e),this.logger.info("Successfully registered commands.")}catch(r){this.logger.error(`Failed to register commands to global: ${r.message}`)}}async chatInteraction(t){return t}async messageInteraction(t){return t}async userInteraction(t){return t}async commandInteraction(t){return t}};a(C,"ApplicationCommandExtension");V([K({event:"interactionCreate"}),v("design:type",Function),v("design:paramtypes",[typeof p.Interaction>"u"?Object:p.Interaction])],C.prototype,"interactionCreate",null);V([M({component:h,parameterless:!0,type:p.ChatInputCommandInteraction}),v("design:type",Function),v("design:paramtypes",[typeof p.ChatInputCommandInteraction>"u"?Object:p.ChatInputCommandInteraction])],C.prototype,"chatInteraction",null);V([M({component:h,parameterless:!0,type:p.MessageContextMenuCommandInteraction}),v("design:type",Function),v("design:paramtypes",[typeof p.MessageContextMenuCommandInteraction>"u"?Object:p.MessageContextMenuCommandInteraction])],C.prototype,"messageInteraction",null);V([M({component:h,parameterless:!0,type:p.UserContextMenuCommandInteraction}),v("design:type",Function),v("design:paramtypes",[typeof p.UserContextMenuCommandInteraction>"u"?Object:p.UserContextMenuCommandInteraction])],C.prototype,"userInteraction",null);V([M({component:h,parameterless:!0,type:p.CommandInteraction}),v("design:type",Function),v("design:paramtypes",[typeof p.UserContextMenuCommandInteraction>"u"?Object:p.UserContextMenuCommandInteraction])],C.prototype,"commandInteraction",null)});var w,fe,Rt=f(()=>{"use strict";$();W();w=class extends x{constructor(t){super(),this.options=t}};a(w,"TextCommandComponent");fe=a(n=>y(new w(n)),"command")});var L,ue,It=f(()=>{"use strict";G();G();L=class extends H{};a(L,"TextCommandRestOption");ue=J(L)});var q,it,_,I,Jt=f(()=>{"use strict";Q();q=require("discord.js");kt();Rt();It();G();it=function(n,t,e,o){var s=arguments.length,r=s<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,o);else for(var i=n.length-1;i>=0;i--)(c=n[i])&&(r=(s<3?c(r):s>3?c(t,e,r):c(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},_=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},I=class extends E{constructor(t){super(),this.config=t}async processPrefix(t){let e=t.content,o=this.config.prefix;if(typeof o=="function"&&(o=await o(t)),typeof o=="string")return e.startsWith(o)?o.length:null;if(o instanceof Array){let s=o.find(r=>e.startsWith(r));return s?s.length:null}return null}async messageCreate(t){try{let e=await this.processPrefix(t);if(!e)return;let o=t.content.slice(e),s=[],r=new Map;for(let d of this.commandClient.registry.extensions)for(let g of this.commandClient.registry.getComponentsWithType(d,w))s.push(g),r.set(g,d);let c=0,i=s.find(d=>{let g=[d.options.name];d.options.aliases&&g.push(...d.options.aliases);for(let k of g)if(o.startsWith(k))return o.length===k.length?(c=k.length,!0):(c=k.length,o.startsWith(k+" "));return!1});if(!i)return;let m=r.get(i);if(!m)return;t.command=i;let u=[],l=o.slice(c+1).split(/ /g);await this.convertArguments(w,u,i.argTypes,async(d,g,k)=>{if(k.options.parameterless)return[t];if(d.decorators.find(lt=>lt.constructor===L)){let lt=l.join(" ");return l=[],[lt,t]}return[l.shift(),t]}),await i.execute(m,u,[t])}catch(e){this.commandClient.emit("textCommandInvokeError",e,t)}}async mesage(t){return t}async str(t){return t}async num(t){return Number(t)}};a(I,"TextCommandExtension");it([K({event:"messageCreate",emitter:"discord"}),_("design:type",Function),_("design:paramtypes",[typeof q.Message>"u"?Object:q.Message])],I.prototype,"messageCreate",null);it([M({component:w,type:q.Message,parameterless:!0}),_("design:type",Function),_("design:paramtypes",[typeof q.Message>"u"?Object:q.Message])],I.prototype,"mesage",null);it([M({component:w,type:String}),_("design:type",Function),_("design:paramtypes",[String])],I.prototype,"str",null);it([M({component:w,type:Number}),_("design:type",Function),_("design:paramtypes",[String])],I.prototype,"num",null)});var Vt={};Gt(Vt,{CommandClient:()=>j});var at,ct,Kt,Qt,j,St=f(()=>{"use strict";at=b(require("chalk")),ct=require("discord.js"),Kt=b(require("events")),Qt=require("tslog");Zt();Jt();O();Ct();j=class extends Kt.default{constructor(t,e=new Qt.Logger({dateTimeTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone}),o={}){super(),this.discord=t,this.logger=e,this.owners=new Set,this.ctsLogger=e.getChildLogger({prefix:[at.default.blue("[command.ts]")],displayFilePath:"hidden",displayFunctionName:!1,...o}),this.registry=new P(this.ctsLogger,this),this.registry.registerEventEmitter("cts",this),this.registry.registerEventEmitter("discord",this.discord)}async isOwner(t){return this.owners.has(t.id)}async fetchOwners(){if(!this.discord.application)throw new Error("The client is not logged in.");this.ctsLogger.info("Fetching owners..."),await this.discord.application.fetch();let t=this.discord.application.owner;if(!t)throw new Error("Cannot find application owner");let e=[];if(t instanceof ct.User)this.owners.add(t.id),e.push(t.tag);else if(t instanceof ct.Team)for(let[o,s]of t.members)this.owners.add(o),e.push(s.user.tag);this.ctsLogger.info(`Fetched ${at.default.green(e.length)} owners(${e.map(o=>at.default.blue(o)).join(", ")})`)}async enableApplicationCommandsExtension(t){await this.registry.registerModule(new C(t)),this.ctsLogger.info("Application command extension enabled.")}async enableTextCommandsExtension(t){await this.registry.registerModule(new I(t)),this.ctsLogger.info("Text command extension enabled.")}getApplicationCommandsExtension(){return this.registry.extensions.find(t=>t.constructor===C)}static getFromModule(t){return Reflect.getMetadata(Y,t)}};a(j,"CommandClient")});var Ht,x,W=f(()=>{"use strict";Ht=require("discord.js");xt();x=class{hooks=new Ht.Collection;argTypes=new Ht.Collection;_init(t,e){this.method=t;for(let o=0;o<e.length;o++){let s=e[o];this.argTypes.set(o,new A(s))}}async executeHook(t,e,o){let s=this.hooks.get(e);if(!s)return;let{CommandClient:r}=await Promise.resolve().then(()=>(St(),Vt)),c=r.getFromModule(t),i=c.registry.globalHooks[e];i&&s.unshift(...i);for(let m of s)await m.call(null,c,...o)}async execute(t,e,o=e){await this.executeHook(t,"beforeCall",o);let s;try{s=await this.method.call(t,...e),await this.executeHook(t,"afterCall",[...o,s])}catch(r){throw await this.executeHook(t,"invokeError",[r,...o]),r}return s}};a(x,"BaseComponent")});var Io,wt=f(()=>{"use strict";Io=require("reflect-metadata");$();xt();Lt();W()});var U,Tt=f(()=>{"use strict";U=class{};a(U,"OwnerOnlyError")});var mt,Xt,de,Yt=f(()=>{"use strict";mt=require("discord.js");st();Tt();Xt=a(n=>et("beforeCall",n),"createCheckDecorator"),de=Xt(async(n,t)=>{let e=!1;if(t instanceof mt.BaseInteraction?e=await n.isOwner(t.user):t instanceof mt.Message&&(e=await n.isOwner(t.author)),!e)throw new U})});var ge,te=f(()=>{"use strict";ge=a(n=>(t,e,o)=>{for(let s of n)s(t,e,o)},"mergeMethodDecorators")});var ee=f(()=>{"use strict";Yt();Tt();te()});var oe=f(()=>{"use strict";vt()});var G=f(()=>{"use strict";wt();st();nt();ee();Q();Mt();oe()});var he={};Gt(he,{ApplicationCommandComponent:()=>h,BaseComponent:()=>x,CommandClient:()=>j,ComponentArgument:()=>A,ComponentArgumentDecorator:()=>H,ConverterComponent:()=>F,Extension:()=>N,ListenerComponent:()=>T,OwnerOnlyError:()=>U,Registry:()=>P,SubCommandGroup:()=>pt,SubCommandGroupChild:()=>X,TextCommandComponent:()=>w,TextCommandRestOption:()=>L,applicationCommand:()=>pe,argConverter:()=>M,command:()=>fe,createArgumentDecorator:()=>J,createCheckDecorator:()=>Xt,createComponentDecorator:()=>y,createComponentHook:()=>et,getComponent:()=>me,getComponentArgumentStore:()=>yt,getComponentStore:()=>Z,getModuleHookStore:()=>rt,listener:()=>K,mergeMethodDecorators:()=>ge,moduleHook:()=>le,option:()=>Ot,ownerOnly:()=>de,rest:()=>ue});module.exports=ce(he);G();ot();bt();var _t=require("discord.js");G();ot();var pt=class{constructor(t,e){this.options=t,this.guilds=e}command(t){let e=new h({type:_t.ApplicationCommandType.ChatInput,...t});return e.subcommandGroup=this,y(e)}createChild(t){return new X(t,this)}};a(pt,"SubCommandGroup");var X=class{constructor(t,e){this.options=t,this.parent=e}command(t){let e=new h({type:_t.ApplicationCommandType.ChatInput,...t});return e.subcommandGroupChild=this,y(e)}};a(X,"SubCommandGroupChild");Rt();It();0&&(module.exports={ApplicationCommandComponent,BaseComponent,CommandClient,ComponentArgument,ComponentArgumentDecorator,ConverterComponent,Extension,ListenerComponent,OwnerOnlyError,Registry,SubCommandGroup,SubCommandGroupChild,TextCommandComponent,TextCommandRestOption,applicationCommand,argConverter,command,createArgumentDecorator,createCheckDecorator,createComponentDecorator,createComponentHook,getComponent,getComponentArgumentStore,getComponentStore,getModuleHookStore,listener,mergeMethodDecorators,moduleHook,option,ownerOnly,rest});
1
+ "use strict";var ne=Object.create;var B=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var ie=Object.getPrototypeOf,ae=Object.prototype.hasOwnProperty;var a=(n,t)=>B(n,"name",{value:t,configurable:!0});var f=(n,t)=>()=>(n&&(t=n(n=0)),t);var Ft=(n,t)=>{for(var e in t)B(n,e,{get:t[e],enumerable:!0})},jt=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of se(t))!ae.call(n,s)&&s!==e&&B(n,s,{get:()=>t[s],enumerable:!(o=re(t,s))||o.enumerable});return n};var C=(n,t,e)=>(e=n!=null?ne(ie(n)):{},jt(t||!n||!n.__esModule?B(e,"default",{value:n,enumerable:!0}):e,n)),ce=n=>jt(B({},"__esModule",{value:!0}),n);var z,xe,ft,Y,ut,tt,O=f(()=>{"use strict";z=Symbol(),xe=Symbol(),ft=Symbol(),Y=Symbol(),ut=Symbol(),tt=Symbol()});var Et,dt,et,gt=f(()=>{"use strict";Et=require("discord.js");O();dt=a((n,t)=>{let e=Reflect.getMetadata(ut,n,t);return e||(e=new Et.Collection,Reflect.defineMetadata(ut,e,n,t)),e},"getComponentHookStore"),et=a((n,t)=>(e,o)=>{let s=dt(e,o),r=s.get(n);r||(r=[],s.set(n,r)),r.unshift(t)},"createComponentHook")});var ht,Z,me,y,yt,J,$=f(()=>{"use strict";ht=require("discord.js");gt();O();Z=a(n=>{let t=Reflect.getMetadata(z,n);return t||(t=new ht.Collection,Reflect.defineMetadata(z,t,n)),t},"getComponentStore"),me=a((n,t)=>Z(n).get(t),"getComponent"),y=a(n=>(t,e)=>{n._init(Reflect.get(t,e),Reflect.getMetadata("design:paramtypes",t,e));let o=dt(t,e);n.hooks=o;let s=Z(t);yt(t,e).forEach((c,i)=>{var m;(m=n.argTypes.get(i))==null||m.decorators.push(c)}),s.set(e,n)},"createComponentDecorator"),yt=a((n,t)=>{let e=Reflect.getMetadata(z,n,t);return e||(e=new ht.Collection,Reflect.defineMetadata(z,e,n,t)),e},"getComponentArgumentStore"),J=a(n=>t=>(e,o,s)=>{var r=new n(t);yt(e,o).set(s,r)},"createArgumentDecorator")});var A,xt=f(()=>{"use strict";A=class{constructor(t){this.type=t,this.decorators=[]}};a(A,"ComponentArgument")});var Lt,H,Ot=f(()=>{"use strict";Lt=C(require("lodash")),H=class{constructor(t){typeof t=="object"?this.options=Lt.default.merge(this.defaultOptions(),t):this.options=t}defaultOptions(){return{}}};a(H,"ComponentArgumentDecorator")});var h,pe,ot=f(()=>{"use strict";$();W();h=class extends x{constructor(t){super(),this.options=t}};a(h,"ApplicationCommandComponent");pe=a(n=>y(new h(n)),"applicationCommand")});var R,$t,bt=f(()=>{"use strict";G();R=class extends H{};a(R,"ApplicationCommandOption");$t=J(R)});var At,T,K,Q=f(()=>{"use strict";At=C(require("lodash"));W();$();T=class extends x{constructor(t){super(),this.options=At.default.merge({emitter:"discord"},t)}};a(T,"ListenerComponent");K=a(n=>y(new T(n)),"listener")});var F,M,nt=f(()=>{"use strict";W();$();F=class extends x{constructor(t){super(),this.options=t}};a(F,"ConverterComponent");M=a(n=>y(new F(n)),"argConverter")});var Wt,rt,le,Dt=f(()=>{"use strict";Wt=require("discord.js");O();rt=a(n=>{let t=Reflect.getMetadata(ft,n);return t||(t=new Wt.Collection,Reflect.defineMetadata(ft,t,n)),t},"getModuleHookStore"),le=a(n=>(t,e)=>{let o=rt(t),s=o.get(n);s||(s=[],o.set(n,s)),s.push(Reflect.get(t,e))},"moduleHook")});var st=f(()=>{"use strict";Dt();gt()});var D,Pt,Nt,qt,Ut,P,Ct=f(()=>{"use strict";D=C(require("chalk")),Pt=require("discord.js"),Nt=C(require("lodash"));wt();st();Q();O();qt=C(require("walk-sync")),Ut=C(require("path")),P=class{constructor(t,e){this.client=e,this.extensions=[],this.emitters=new Pt.Collection,this.globalHooks={},this.logger=t.getChildLogger({prefix:[D.default.green("[Registry]")]})}addGlobalHook(t,e){let o=this.globalHooks[t];o||(o=[],this.globalHooks[t]=o),o.push(e)}getComponentsWithTypeGlobal(t){let e=[];for(let o of this.extensions)e.push(...this.getComponentsWithType(o,t));return e}getComponentsWithType(t,e){let o=Z(t);return Array.from(o.filter(s=>s.constructor===e).values())}registerEventListeners(t){let e=this.getComponentsWithType(t,T);for(let o of e){let s=this.emitters.get(o.options.emitter);if(s){let r=o.method.bind(t);Reflect.defineMetadata("bound",r,o),s.addListener(o.options.event,r)}}}unregisterEventListeners(t){let e=this.getComponentsWithType(t,T);for(let o of e){let s=this.emitters.get(o.options.emitter),r=Reflect.getMetadata("bound",o);s&&r&&s.removeListener(o.options.event,r)}}async loadAllModulesInDirectory(t){let e=[],o=(0,qt.default)(t).filter(s=>s.endsWith(".ts")||s.endsWith(".js"));for(let s of o){if(s.endsWith(".d.ts"))continue;let r=Ut.default.join(t,s);e.push(...await this.loadModulesAtPath(r))}return e}async loadModulesAtPath(t){this.logger.info(`Loading module at path ${D.default.green(t)}`);let e=require.resolve(t),o=require(e);if(typeof o.setup!="function")throw new Error("Extension must have a setup function");let s=await o.setup(this.client);return this.registerModules(s,e)}async registerModules(t,e){let o=[];if(t instanceof Array)for(let s of t)await this.registerModule(s),Reflect.defineMetadata(tt,e,s),o.push(s);else await this.registerModule(t),Reflect.defineMetadata(tt,e,t),o.push(t);return o}async reloadModules(){let t=[],e=new Set,o=[...this.extensions];for(let s of o){let r=Reflect.getMetadata(tt,s);!r||(this.logger.info(`Unloading module: ${D.default.green(s.constructor.name)}`),e.add(r),await this.unregisterModule(s),delete require.cache[require.resolve(r)])}for(let s of e)try{let r=await this.loadModulesAtPath(s);t.push({file:s,result:!0,extensions:r})}catch(r){t.push({file:s,result:!1,error:r})}return t}async registerModule(t){Reflect.defineMetadata(Y,this.client,t),this.registerEventListeners(t),await this.runModuleHook(t,"load"),this.extensions.push(t),this.logger.info(`Module registered: ${D.default.green(t.constructor.name)}`)}async unregisterModule(t){this.unregisterEventListeners(t),await this.runModuleHook(t,"unload"),Nt.default.remove(this.extensions,e=>e===t),this.logger.info(`Module unregistered: ${D.default.green(t.constructor.name)}`)}runModuleHook(t,e,...o){let r=rt(t).get(e);if(r)for(let c of r)c.call(t,...o)}registerEventEmitter(t,e){this.emitters.set(t,e)}};a(P,"Registry")});var Mt=f(()=>{"use strict";Ct();St()});var Bt,zt,N,vt=f(()=>{"use strict";Bt=C(require("chalk")),zt=require("discord.js");nt();Mt();N=class{get commandClient(){return j.getFromModule(this)}get client(){return this.commandClient.discord}get logger(){return this._logger||(this._logger=this.commandClient.logger.getChildLogger({prefix:[Bt.default.green(`[${this.constructor.name}]`)],displayFunctionName:!1})),this._logger}async convertArguments(t,e,o,s){let r=new zt.Collection;for(let c of this.commandClient.registry.extensions)for(let i of this.commandClient.registry.getComponentsWithType(c,F))i.options.component==t&&r.set(i.options.type,{component:i,ext:c});for(let[c,i]of o){let m=r.get(i.type);if(!m){e[c]=void 0;continue}let u=await s(i,c,m.component);e[c]=await m.component.execute(m.ext,u)}}};a(N,"Extension")});var Zt,E,kt=f(()=>{"use strict";Zt=C(require("chalk"));vt();E=class extends N{get logger(){return this._logger||(this._logger=this.commandClient.ctsLogger.getChildLogger({prefix:[Zt.default.green(`[${this.constructor.name}]`)],displayFunctionName:!1})),this._logger}};a(E,"CTSExtension")});var S,p,V,v,b,Rt=f(()=>{"use strict";S=C(require("chalk")),p=require("discord.js");ot();bt();Q();nt();kt();V=function(n,t,e,o){var s=arguments.length,r=s<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,o);else for(var i=n.length-1;i>=0;i--)(c=n[i])&&(r=(s<3?c(r):s>3?c(t,e,r):c(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},v=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},b=class extends E{constructor(t){super(),this.config=t,this.unmanagedCommands=[]}registerUnmanagedCommand(t){this.unmanagedCommands.push(t)}async interactionCreate(t){var e;try{if(t.type!==p.InteractionType.ApplicationCommand)return;let o=null,s=null,r=this.commandClient.registry.extensions,c=null,i=null;t.commandType===p.ApplicationCommandType.ChatInput&&(c=t.options.getSubcommand(!1),i=t.options.getSubcommandGroup(!1));t:for(let m of r){let u=this.commandClient.registry.getComponentsWithType(m,h);if(c){for(let l of u)if(!(!l.subcommandGroup&&!l.subcommandGroupChild)){if(l.subcommandGroupChild&&l.subcommandGroupChild.parent.options.name===t.commandName&&l.subcommandGroupChild.options.name===i&&l.options.name===c){s=m,o=l;break t}if(l.subcommandGroup&&!i&&l.subcommandGroup.options.name===t.commandName&&l.options.name===c){s=m,o=l;break t}}}else for(let l of u)if(l.options.name===t.commandName){s=m,o=l;break t}}if(o&&s){let m=[];await this.convertArguments(h,m,o.argTypes,()=>[t]);for(let[u,l]of o.argTypes){let d=null;for(let g of l.decorators)if(g instanceof R){if([p.ApplicationCommandOptionType.Subcommand,p.ApplicationCommandOptionType.SubcommandGroup].includes(g.options.type)&&t.isChatInputCommand()){if(g.options.type===p.ApplicationCommandOptionType.Subcommand){d=t.options.getSubcommand()===g.options.name;break}if(g.options.type===p.ApplicationCommandOptionType.SubcommandGroup){d=t.options.getSubcommandGroup()===g.options.name;break}}d=(e=t.options.get(g.options.name,!1))==null?void 0:e.value;break}d&&(m[u]=d)}await o.execute(s,m,[t])}}catch(o){this.commandClient.emit("applicationCommandInvokeError",o,t)}}async sync(){let t=this.commandClient;this.logger.info("Trying to sync commands...");let e=[],o=new p.Collection,s=new p.Collection;for(let r of t.registry.getComponentsWithTypeGlobal(h)){if(r.subcommandGroup){let i=s.get(r.subcommandGroup.options.name);if(!i){if(i={...r.subcommandGroup.options,type:p.ApplicationCommandType.ChatInput},r.subcommandGroup.guilds)for(let u of r.subcommandGroup.guilds){let l=o.get(u);l||(l=[],o.set(u,l))}else e.push(i);s.set(r.subcommandGroup.options.name,i)}i.options||(i.options=[]);let m=[];for(let[,u]of r.argTypes){let l=u.decorators.find(d=>d.constructor===R);l&&m.push(l.options)}i.options.push({...r.options,type:p.ApplicationCommandOptionType.Subcommand,options:m});continue}else if(r.subcommandGroupChild){let i=r.subcommandGroupChild.parent,m=s.get(i.options.name);if(!m){if(m={...i.options,type:p.ApplicationCommandType.ChatInput},i.guilds)for(let d of i.guilds){let g=o.get(d);g||(g=[],o.set(d,g))}else e.push(m);s.set(i.options.name,m)}m.options||(m.options=[]);let u=m.options.find(d=>d.name===r.subcommandGroupChild.options.name);u||(u={type:p.ApplicationCommandOptionType.SubcommandGroup,...r.subcommandGroupChild.options},m.options.push(u)),u.options||(u.options=[]);let l=[];for(let[,d]of r.argTypes){let g=d.decorators.find(k=>k.constructor===R);g&&l.push(g.options)}u.options.push({...r.options,type:p.ApplicationCommandOptionType.Subcommand,options:l});continue}let c={...r.options};if(c.type===p.ApplicationCommandType.ChatInput){c.options=[];for(let[,i]of r.argTypes){let m=i.decorators.find(u=>u.constructor===R);m&&c.options.push(m.options)}}if(await r.executeHook(this,"beforeSync",[c,r]),r.options.guilds){for(let i of r.options.guilds){let m=o.get(i);m||(m=[],o.set(i,m)),m.push(c)}continue}e.push(c)}for(let{guilds:r,...c}of this.unmanagedCommands)if(r){for(let i of r){let m=o.get(i);m||(m=[],o.set(i,m)),m.push(c)}continue}else e.push(c);if(this.config.guilds){for(let r of this.config.guilds){let c=o.get(r);c||(c=[],o.set(r,c)),c.push(...e)}e=[]}if(o.size)for(let[r,c]of o)try{let i=await this.client.guilds.fetch(r);await i.fetch(),this.logger.info(`Processing ${S.default.green(c.length)} commands(${c.map(m=>S.default.blue(m.name)).join(", ")}) for guild ${S.default.green(i.name)}(${S.default.blue(i.id)})`),await i.commands.set(c),this.logger.info(`Successfully registered commands for guild ${S.default.green(i.name)}(${S.default.blue(i.id)})`)}catch(i){this.logger.error(`Failed to register commands to guild ${S.default.green(r)}: ${i.message}`)}if(e.length)try{this.logger.info(`Processing ${S.default.green(e.length)} commands(${e.map(r=>S.default.blue(r.name)).join(", ")}) for application scope...`),await this.client.application.commands.set(e),this.logger.info("Successfully registered commands.")}catch(r){this.logger.error(`Failed to register commands to global: ${r.message}`)}}async chatInteraction(t){return t}async messageInteraction(t){return t}async userInteraction(t){return t}async commandInteraction(t){return t}};a(b,"ApplicationCommandExtension");V([K({event:"interactionCreate"}),v("design:type",Function),v("design:paramtypes",[typeof p.Interaction>"u"?Object:p.Interaction])],b.prototype,"interactionCreate",null);V([M({component:h,parameterless:!0,type:p.ChatInputCommandInteraction}),v("design:type",Function),v("design:paramtypes",[typeof p.ChatInputCommandInteraction>"u"?Object:p.ChatInputCommandInteraction])],b.prototype,"chatInteraction",null);V([M({component:h,parameterless:!0,type:p.MessageContextMenuCommandInteraction}),v("design:type",Function),v("design:paramtypes",[typeof p.MessageContextMenuCommandInteraction>"u"?Object:p.MessageContextMenuCommandInteraction])],b.prototype,"messageInteraction",null);V([M({component:h,parameterless:!0,type:p.UserContextMenuCommandInteraction}),v("design:type",Function),v("design:paramtypes",[typeof p.UserContextMenuCommandInteraction>"u"?Object:p.UserContextMenuCommandInteraction])],b.prototype,"userInteraction",null);V([M({component:h,parameterless:!0,type:p.CommandInteraction}),v("design:type",Function),v("design:paramtypes",[typeof p.UserContextMenuCommandInteraction>"u"?Object:p.UserContextMenuCommandInteraction])],b.prototype,"commandInteraction",null)});var w,fe,It=f(()=>{"use strict";$();W();w=class extends x{constructor(t){super(),this.options=t}};a(w,"TextCommandComponent");fe=a(n=>y(new w(n)),"command")});var L,ue,Ht=f(()=>{"use strict";G();G();L=class extends H{};a(L,"TextCommandRestOption");ue=J(L)});var q,it,_,I,Jt=f(()=>{"use strict";Q();q=require("discord.js");kt();It();Ht();G();it=function(n,t,e,o){var s=arguments.length,r=s<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,o);else for(var i=n.length-1;i>=0;i--)(c=n[i])&&(r=(s<3?c(r):s>3?c(t,e,r):c(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},_=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},I=class extends E{constructor(t){super(),this.config=t}async processPrefix(t){let e=t.content,o=this.config.prefix;if(typeof o=="function"&&(o=await o(t)),typeof o=="string")return e.startsWith(o)?o.length:null;if(o instanceof Array){let s=o.find(r=>e.startsWith(r));return s?s.length:null}return null}async messageCreate(t){try{let e=await this.processPrefix(t);if(!e)return;let o=t.content.slice(e),s=[],r=new Map;for(let d of this.commandClient.registry.extensions)for(let g of this.commandClient.registry.getComponentsWithType(d,w))s.push(g),r.set(g,d);let c=0,i=s.find(d=>{let g=[d.options.name];d.options.aliases&&g.push(...d.options.aliases);for(let k of g)if(o.startsWith(k))return o.length===k.length?(c=k.length,!0):(c=k.length,o.startsWith(k+" "));return!1});if(!i)return;let m=r.get(i);if(!m)return;t.command=i;let u=[],l=o.slice(c+1).split(/ /g);await this.convertArguments(w,u,i.argTypes,async(d,g,k)=>{if(k.options.parameterless)return[t];if(d.decorators.find(lt=>lt.constructor===L)){let lt=l.join(" ");return l=[],[lt,t]}return[l.shift(),t]}),await i.execute(m,u,[t])}catch(e){this.commandClient.emit("textCommandInvokeError",e,t)}}async mesage(t){return t}async str(t){return t}async num(t){return Number(t)}};a(I,"TextCommandExtension");it([K({event:"messageCreate",emitter:"discord"}),_("design:type",Function),_("design:paramtypes",[typeof q.Message>"u"?Object:q.Message])],I.prototype,"messageCreate",null);it([M({component:w,type:q.Message,parameterless:!0}),_("design:type",Function),_("design:paramtypes",[typeof q.Message>"u"?Object:q.Message])],I.prototype,"mesage",null);it([M({component:w,type:String}),_("design:type",Function),_("design:paramtypes",[String])],I.prototype,"str",null);it([M({component:w,type:Number}),_("design:type",Function),_("design:paramtypes",[String])],I.prototype,"num",null)});var Vt={};Ft(Vt,{CommandClient:()=>j});var at,ct,Kt,Qt,j,St=f(()=>{"use strict";at=C(require("chalk")),ct=require("discord.js"),Kt=C(require("events")),Qt=require("tslog");Rt();Jt();O();Ct();j=class extends Kt.default{constructor(t,e=new Qt.Logger({dateTimeTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone}),o={}){super(),this.discord=t,this.logger=e,this.owners=new Set,this.ctsLogger=e.getChildLogger({prefix:[at.default.blue("[command.ts]")],displayFilePath:"hidden",displayFunctionName:!1,...o}),this.registry=new P(this.ctsLogger,this),this.registry.registerEventEmitter("cts",this),this.registry.registerEventEmitter("discord",this.discord)}async isOwner(t){return this.owners.has(t.id)}async fetchOwners(){if(!this.discord.application)throw new Error("The client is not logged in.");this.ctsLogger.info("Fetching owners..."),await this.discord.application.fetch();let t=this.discord.application.owner;if(!t)throw new Error("Cannot find application owner");let e=[];if(t instanceof ct.User)this.owners.add(t.id),e.push(t.tag);else if(t instanceof ct.Team)for(let[o,s]of t.members)this.owners.add(o),e.push(s.user.tag);this.ctsLogger.info(`Fetched ${at.default.green(e.length)} owners(${e.map(o=>at.default.blue(o)).join(", ")})`)}async enableApplicationCommandsExtension(t){await this.registry.registerModule(new b(t)),this.ctsLogger.info("Application command extension enabled.")}async enableTextCommandsExtension(t){await this.registry.registerModule(new I(t)),this.ctsLogger.info("Text command extension enabled.")}getApplicationCommandsExtension(){return this.registry.extensions.find(t=>t.constructor===b)}static getFromModule(t){return Reflect.getMetadata(Y,t)}};a(j,"CommandClient")});var Tt,x,W=f(()=>{"use strict";Tt=require("discord.js");xt();x=class{hooks=new Tt.Collection;argTypes=new Tt.Collection;_init(t,e){this.method=t;for(let o=0;o<e.length;o++){let s=e[o];this.argTypes.set(o,new A(s))}}async executeHook(t,e,o){let s=this.hooks.get(e);if(!s)return;let{CommandClient:r}=await Promise.resolve().then(()=>(St(),Vt)),c=r.getFromModule(t),i=c.registry.globalHooks[e];i&&s.unshift(...i);for(let m of s)await m.call(null,c,...o)}async execute(t,e,o=e){await this.executeHook(t,"beforeCall",o);let s;try{s=await this.method.call(t,...e),await this.executeHook(t,"afterCall",[...o,s])}catch(r){throw await this.executeHook(t,"invokeError",[r,...o]),r}return s}};a(x,"BaseComponent")});var Io,wt=f(()=>{"use strict";Io=require("reflect-metadata");$();xt();Ot();W()});var U,_t=f(()=>{"use strict";U=class{};a(U,"OwnerOnlyError")});var mt,Xt,de,Yt=f(()=>{"use strict";mt=require("discord.js");st();_t();Xt=a(n=>et("beforeCall",n),"createCheckDecorator"),de=Xt(async(n,t)=>{let e=!1;if(t instanceof mt.BaseInteraction?e=await n.isOwner(t.user):t instanceof mt.Message&&(e=await n.isOwner(t.author)),!e)throw new U})});var ge,te=f(()=>{"use strict";ge=a(n=>(t,e,o)=>{for(let s of n)s(t,e,o)},"mergeMethodDecorators")});var ee=f(()=>{"use strict";Yt();_t();te()});var oe=f(()=>{"use strict";vt()});var G=f(()=>{"use strict";wt();st();nt();ee();Q();Mt();oe()});var he={};Ft(he,{ApplicationCommandComponent:()=>h,ApplicationCommandExtension:()=>b,BaseComponent:()=>x,CommandClient:()=>j,ComponentArgument:()=>A,ComponentArgumentDecorator:()=>H,ConverterComponent:()=>F,Extension:()=>N,ListenerComponent:()=>T,OwnerOnlyError:()=>U,Registry:()=>P,SubCommandGroup:()=>pt,SubCommandGroupChild:()=>X,TextCommandComponent:()=>w,TextCommandRestOption:()=>L,applicationCommand:()=>pe,argConverter:()=>M,command:()=>fe,createArgumentDecorator:()=>J,createCheckDecorator:()=>Xt,createComponentDecorator:()=>y,createComponentHook:()=>et,getComponent:()=>me,getComponentArgumentStore:()=>yt,getComponentStore:()=>Z,getModuleHookStore:()=>rt,listener:()=>K,mergeMethodDecorators:()=>ge,moduleHook:()=>le,option:()=>$t,ownerOnly:()=>de,rest:()=>ue});module.exports=ce(he);G();ot();bt();var Gt=require("discord.js");G();ot();var pt=class{constructor(t,e){this.options=t,this.guilds=e}command(t){let e=new h({type:Gt.ApplicationCommandType.ChatInput,...t});return e.subcommandGroup=this,y(e)}createChild(t){return new X(t,this)}};a(pt,"SubCommandGroup");var X=class{constructor(t,e){this.options=t,this.parent=e}command(t){let e=new h({type:Gt.ApplicationCommandType.ChatInput,...t});return e.subcommandGroupChild=this,y(e)}};a(X,"SubCommandGroupChild");Rt();It();Ht();0&&(module.exports={ApplicationCommandComponent,ApplicationCommandExtension,BaseComponent,CommandClient,ComponentArgument,ComponentArgumentDecorator,ConverterComponent,Extension,ListenerComponent,OwnerOnlyError,Registry,SubCommandGroup,SubCommandGroupChild,TextCommandComponent,TextCommandRestOption,applicationCommand,argConverter,command,createArgumentDecorator,createCheckDecorator,createComponentDecorator,createComponentHook,getComponent,getComponentArgumentStore,getComponentStore,getModuleHookStore,listener,mergeMethodDecorators,moduleHook,option,ownerOnly,rest});
2
2
  //# sourceMappingURL=index.js.map