changed test-commands

This commit is contained in:
jacoobes
2022-02-09 10:07:34 -06:00
parent 6aa22e74b5
commit c849877bf7
2 changed files with 7 additions and 6 deletions

View File

@@ -81,9 +81,11 @@ export class Handler {
if (module?.mod === undefined) return "Unknown legacy command";
if (module.mod.visibility === "private") {
const checkTest = this.privateServers.find(({id}) => id === message.guildId!)?.test;
if(checkTest === undefined) return "This command has the private modifier but is not registered under Handler#privateServers";
const checkIsTestServer = this.privateServers.find(({id}) => id === message.guildId!)?.test;
if(checkIsTestServer === undefined) return "This command has the private modifier but is not registered under Handler#privateServers";
if(checkIsTestServer !== module.testOnly) {
return "This private command is a testing command";
}
}

View File

@@ -25,9 +25,8 @@ async function readPath(dir: string, arrayOfFiles: string[] = []): Promise<strin
}
const fmtFileName = (n : string) => {
return n
.toLowerCase()
.endsWith("-test.js")
const endsW = n.toLowerCase().endsWith("-test.js") || n.toLowerCase().endsWith("-test.ts");
return endsW
? { cmdName : n.substring(0, n.length - 8), testOnly : true }
: { cmdName: n.substring(0, n.length - 3), testOnly: false};
};