diff --git a/src/class/CSCLI.ts b/src/class/CSCLI.ts index f302298..e255d22 100644 --- a/src/class/CSCLI.ts +++ b/src/class/CSCLI.ts @@ -7,8 +7,6 @@ import { promises as fs } from 'fs'; import { Client, Collection, Context } from '.'; import type { TCPHandler } from '.'; -import * as handlerFiles from '../cscli/handlers'; - export default class CSCLI { public client: Client; @@ -34,7 +32,7 @@ export default class CSCLI { this.init(); } - public load() { + public load(handlerFiles: { [s: string]: typeof TCPHandler; } | ArrayLike) { const hdFiles = Object.values(handlerFiles); for (const Handler of hdFiles) { const handler = new Handler(); diff --git a/src/class/Client.ts b/src/class/Client.ts index 0d08dd3..51c110d 100644 --- a/src/class/Client.ts +++ b/src/class/Client.ts @@ -8,6 +8,8 @@ import { Account, AccountInterface, Moderation, ModerationInterface, Domain, Dom import { emojis } from '../stores'; import { Command, CSCLI, Util, Collection, Server, Event } from '.'; +import * as handlerFiles from '../cscli'; + export default class Client extends Eris.Client { public config: { 'token': string; 'cloudflare': string; 'prefix': string; 'emailPass': string; 'mongoURL': string; 'port': number; 'keyPair': { 'publicKey': string; 'privateKey': string; }; vendorKey: string; internalKey: string; }; @@ -139,7 +141,8 @@ export default class Client extends Eris.Client { }); this.server = new Server(this, { port: this.config.port }); // eslint-disable-next-line no-new - new CSCLI(this); + const cscli = new CSCLI(this); + cscli.load(handlerFiles); const corepath = '/opt/CloudServices/dist'; const cmdFiles = await fs.readdir('/opt/CloudServices/dist/commands'); diff --git a/src/cscli/handlers/index.ts b/src/cscli/index.ts similarity index 100% rename from src/cscli/handlers/index.ts rename to src/cscli/index.ts diff --git a/src/cscli/handlers/killpid.ts b/src/cscli/killpid.ts similarity index 83% rename from src/cscli/handlers/killpid.ts rename to src/cscli/killpid.ts index 67d4408..f3cad50 100644 --- a/src/cscli/handlers/killpid.ts +++ b/src/cscli/killpid.ts @@ -1,4 +1,4 @@ -import { TCPHandler, Context } from '../../class'; +import { TCPHandler, Context } from '../class'; export default class KillPID extends TCPHandler { constructor() { diff --git a/src/cscli/handlers/lock.ts b/src/cscli/lock.ts similarity index 85% rename from src/cscli/handlers/lock.ts rename to src/cscli/lock.ts index f610141..1f782d9 100644 --- a/src/cscli/handlers/lock.ts +++ b/src/cscli/lock.ts @@ -1,4 +1,4 @@ -import { TCPHandler, Context } from '../../class'; +import { TCPHandler, Context } from '../class'; export default class Lock extends TCPHandler { constructor() { diff --git a/src/cscli/handlers/processCount.ts b/src/cscli/processCount.ts similarity index 86% rename from src/cscli/handlers/processCount.ts rename to src/cscli/processCount.ts index da1b79f..94ec396 100644 --- a/src/cscli/handlers/processCount.ts +++ b/src/cscli/processCount.ts @@ -1,4 +1,4 @@ -import { TCPHandler, Context } from '../../class'; +import { TCPHandler, Context } from '../class'; export default class ProcessCount extends TCPHandler { constructor() { diff --git a/src/cscli/handlers/ram.ts b/src/cscli/ram.ts similarity index 75% rename from src/cscli/handlers/ram.ts rename to src/cscli/ram.ts index 6e943f8..9abcdea 100644 --- a/src/cscli/handlers/ram.ts +++ b/src/cscli/ram.ts @@ -1,5 +1,5 @@ -import { TCPHandler, Context } from '../../class'; -import { dataConversion } from '../../functions'; +import { TCPHandler, Context } from '../class'; +import { dataConversion } from '../functions'; export default class RAM extends TCPHandler { constructor() { diff --git a/src/cscli/handlers/ramLimit.ts b/src/cscli/ramLimit.ts similarity index 89% rename from src/cscli/handlers/ramLimit.ts rename to src/cscli/ramLimit.ts index 37300ed..69d6c30 100644 --- a/src/cscli/handlers/ramLimit.ts +++ b/src/cscli/ramLimit.ts @@ -1,4 +1,4 @@ -import { TCPHandler, Context } from '../../class'; +import { TCPHandler, Context } from '../class'; export default class RAMLimits extends TCPHandler { constructor() { diff --git a/src/cscli/handlers/score.ts b/src/cscli/score.ts similarity index 92% rename from src/cscli/handlers/score.ts rename to src/cscli/score.ts index ca8c94e..61fabc9 100644 --- a/src/cscli/handlers/score.ts +++ b/src/cscli/score.ts @@ -1,4 +1,4 @@ -import { TCPHandler, Context, Report } from '../../class'; +import { TCPHandler, Context, Report } from '../class'; export default class Score extends TCPHandler { constructor() { diff --git a/src/cscli/handlers/sshLogins.ts b/src/cscli/sshLogins.ts similarity index 85% rename from src/cscli/handlers/sshLogins.ts rename to src/cscli/sshLogins.ts index 5600649..18bd943 100644 --- a/src/cscli/handlers/sshLogins.ts +++ b/src/cscli/sshLogins.ts @@ -1,4 +1,4 @@ -import { TCPHandler, Context } from '../../class'; +import { TCPHandler, Context } from '../class'; export default class SSHLogins extends TCPHandler { constructor() { diff --git a/src/cscli/handlers/storage.ts b/src/cscli/storage.ts similarity index 77% rename from src/cscli/handlers/storage.ts rename to src/cscli/storage.ts index fb8e0bf..1c948d5 100644 --- a/src/cscli/handlers/storage.ts +++ b/src/cscli/storage.ts @@ -1,5 +1,5 @@ -import { TCPHandler, Context } from '../../class'; -import { dataConversion } from '../../functions'; +import { TCPHandler, Context } from '../class'; +import { dataConversion } from '../functions'; export default class Storage extends TCPHandler { constructor() { diff --git a/src/cscli/handlers/userInfo.ts b/src/cscli/userInfo.ts similarity index 85% rename from src/cscli/handlers/userInfo.ts rename to src/cscli/userInfo.ts index 3e293af..5e9dd36 100644 --- a/src/cscli/handlers/userInfo.ts +++ b/src/cscli/userInfo.ts @@ -1,4 +1,4 @@ -import { TCPHandler, Context } from '../../class'; +import { TCPHandler, Context } from '../class'; export default class UserInfo extends TCPHandler { constructor() {