merge-requests/1/merge
Bsian 2019-10-15 23:44:46 +01:00
parent ce01f5d290
commit 17760f41c4
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
1 changed files with 4 additions and 3 deletions

View File

@ -14,10 +14,10 @@ export default class Util {
public async exec(command: string): Promise<string> {
const ex = promisify(childProcess.exec);
let result: string;
// eslint-disable-next-line no-useless-catch
try {
const res = await ex(command);
if (res.stderr) result = res.stderr;
else result = res.stdout;
result = res.stderr || res.stdout;
} catch (err) {
throw err;
}
@ -32,10 +32,11 @@ export default class Util {
public resolveCommand(command: string): Command {
if (this.client.commands.has(command)) return this.client.commands.get(command);
for (const cmd of this.client.commands.values()) {
if (!cmd.aliases) continue;
if (!cmd.aliases) continue;// eslint-disable-line no-continue
for (const alias of cmd.aliases) {
if (command === alias.toLowerCase()) return cmd;
}
}
return undefined;
}
}