From 9549c99ebb57c9794022c648c8df2452bf3ceeaf Mon Sep 17 00:00:00 2001 From: Bsian Date: Sat, 4 Jan 2020 15:43:45 +0000 Subject: [PATCH] no need to use promise.allsettled --- src/commands/parseall.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/commands/parseall.ts b/src/commands/parseall.ts index 03598d7..1aa5fc2 100644 --- a/src/commands/parseall.ts +++ b/src/commands/parseall.ts @@ -35,8 +35,7 @@ export default class Parseall extends Command { // @ts-ignore const parsed: ({ status: 'fulfilled', value: Certificate } | { status: 'rejected', reason: Error })[] = await Promise.allSettled(files.map((c) => parseCertificate(this.client, c))); - // @ts-ignore - const final: {status: 'fulfilled', value: string}[] = await Promise.allSettled(search.map(async (a) => { + const final: string[] = await Promise.all(search.map(async (a) => { const result = parsed[search.findIndex((acc) => acc === a)]; if (result.status === 'rejected') { if (result.reason.message.includes('no such file or directory') || result.reason.message.includes('File doesn\'t exist.')) return `${this.client.stores.emojis.error} **${a.username}** Unable to locate certificate`; @@ -59,12 +58,11 @@ export default class Parseall extends Command { if (notAfter < new Date()) return `${this.client.stores.emojis.error} **${a.username}** Expired ${time} ago`; return `${this.client.stores.emojis.success} **${a.username}** Expires in ${time}`; })); + this.client.signale.info(final); - const result = final.map((a) => a.value); - - if (result.join('\n').length < 2048) embed.setDescription(result.join('\n')); + if (final.join('\n').length < 2048) embed.setDescription(final.join('\n')); else { - const split = this.client.util.splitString(result.join('\n'), 1024); + const split = this.client.util.splitString(final.join('\n'), 1024); split.forEach((s) => embed.addField('\u200B', s)); }