diff --git a/package.json b/package.json
index 1bfde1d..9514687 100644
--- a/package.json
+++ b/package.json
@@ -16,7 +16,7 @@
"scripts": {
"clean": "rimraf dist",
"compile:dev": "tsc",
- "compile:prod": "rollup -c --compact && yarn compile:dev && cp -r dist/src/commands dist/commands && rimraf dist/src",
+ "compile:prod": "rollup -c --compact",
"commit": "commit",
"coverage": "NODE_CONFIG_ENV=tests nyc yarn run test",
"lint": "eslint --format=pretty src/**/*.ts",
@@ -87,6 +87,7 @@
"nyc": "^15.1.0",
"rimraf": "^3.0.2",
"rollup": "^2.52.1",
+ "rollup-plugin-multi-input": "^1.3.1",
"rollup-plugin-terser": "^7.0.2",
"sinon": "^11.1.1",
"standard-version": "^9.3.0",
diff --git a/rollup.config.js b/rollup.config.js
index c84748a..cd9d387 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -17,9 +17,10 @@
import typescript from '@rollup/plugin-typescript';
import json from '@rollup/plugin-json';
import { terser } from 'rollup-plugin-terser';
+import multiInput from 'rollup-plugin-multi-input';
export default {
- input: 'src/index.ts',
+ input: ['src/index.ts', 'src/commands/**/*.ts'],
output: {
dir: 'dist',
format: 'cjs',
@@ -28,5 +29,6 @@ export default {
typescript({ module: 'ESNext', include: ['src/**/*.ts', '*.json'] }),
json({ compact: true, preferConst: true }),
terser(),
+ multiInput(),
],
};
diff --git a/src/commands/utils/vm.ts b/src/commands/utils/vm.ts
new file mode 100644
index 0000000..c606cf5
--- /dev/null
+++ b/src/commands/utils/vm.ts
@@ -0,0 +1,29 @@
+/*
+ * This file is part of ArgonBot
+ *
+ * ArgonBot is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * ArgonBot is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with ArgonBot. If not, see .
+ */
+import Command from '@structures/command';
+
+import type { Client } from 'discord.js';
+
+export class vm extends Command {
+ public constructor(client: Client) {
+ super(client);
+ }
+
+ public run(): void {
+ console.log('Test');
+ }
+}
diff --git a/src/index.ts b/src/index.ts
index 5726605..129c3bf 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -14,6 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with ArgonBot. If not, see .
*/
+import path from 'path';
+
require('module-alias/register');
import process from 'process';
@@ -108,9 +110,11 @@ client.on('ready', async () => {
files?.forEach((file) => {
if(file.endsWith('js')) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
- const fileCommand = require(file).default;
+ const fileCommand = require(file);
- const command = new fileCommand();
+ console.log(fileCommand);
+
+ const command = new fileCommand[path.basename(file, path.extname(file))]();
commands.set(command.options.name, command);
diff --git a/yarn.lock b/yarn.lock
index c8ea6c3..0b70ef6 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1576,6 +1576,7 @@ __metadata:
nyc: ^15.1.0
rimraf: ^3.0.2
rollup: ^2.52.1
+ rollup-plugin-multi-input: ^1.3.1
rollup-plugin-terser: ^7.0.2
sinon: ^11.1.1
sodium: ^3.0.2
@@ -2536,6 +2537,13 @@ __metadata:
languageName: node
linkType: hard
+"core-js@npm:^3.1.3":
+ version: 3.14.0
+ resolution: "core-js@npm:3.14.0"
+ checksum: a450089e5796496c7f4a84b13139d853fec5233077833ed142fe401bf9ff4ec2a5bae781f3879ef76cefcfe8a274218d3d4d7d813f5f7f32911fbd36e13a6dc4
+ languageName: node
+ linkType: hard
+
"core-util-is@npm:^1.0.2, core-util-is@npm:~1.0.0":
version: 1.0.2
resolution: "core-util-is@npm:1.0.2"
@@ -3240,7 +3248,7 @@ __metadata:
languageName: node
linkType: hard
-"fast-glob@npm:^3.1.1, fast-glob@npm:^3.2.2":
+"fast-glob@npm:^3.0.0, fast-glob@npm:^3.1.1, fast-glob@npm:^3.2.2":
version: 3.2.5
resolution: "fast-glob@npm:3.2.5"
dependencies:
@@ -4862,7 +4870,7 @@ __metadata:
languageName: node
linkType: hard
-"lodash@npm:^4.17.15, lodash@npm:^4.17.19, lodash@npm:^4.17.21, lodash@npm:^4.5.1":
+"lodash@npm:^4.17.11, lodash@npm:^4.17.15, lodash@npm:^4.17.19, lodash@npm:^4.17.21, lodash@npm:^4.5.1":
version: 4.17.21
resolution: "lodash@npm:4.17.21"
checksum: eb835a2e51d381e561e508ce932ea50a8e5a68f4ebdd771ea240d3048244a8d13658acbd502cd4829768c56f2e16bdd4340b9ea141297d472517b83868e677f7
@@ -6580,6 +6588,17 @@ __metadata:
languageName: node
linkType: hard
+"rollup-plugin-multi-input@npm:^1.3.1":
+ version: 1.3.1
+ resolution: "rollup-plugin-multi-input@npm:1.3.1"
+ dependencies:
+ core-js: ^3.1.3
+ fast-glob: ^3.0.0
+ lodash: ^4.17.11
+ checksum: b4e3288ac5173b8e7ec236a8ae6fd20110d90a22b51ea7eb89034e7011615edd3d55e018ba684af1fbb04bcaa469398b4913b21a18517417e40895e14ff8a503
+ languageName: node
+ linkType: hard
+
"rollup-plugin-terser@npm:^7.0.2":
version: 7.0.2
resolution: "rollup-plugin-terser@npm:7.0.2"