From 622a8c3316600d74e225ebf2bdf744139ca0c943 Mon Sep 17 00:00:00 2001 From: Dragory Date: Thu, 16 Aug 2018 20:08:09 +0300 Subject: [PATCH] fix(censor): don't crash on invalid invites --- src/plugins/Censor.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/plugins/Censor.ts b/src/plugins/Censor.ts index ff3fe9bc..5e924920 100644 --- a/src/plugins/Censor.ts +++ b/src/plugins/Censor.ts @@ -89,13 +89,7 @@ export class CensorPlugin extends Plugin { const inviteCodes = getInviteCodesInString(msg.content); let invites: Invite[] = await Promise.all( - inviteCodes.map(code => { - try { - return this.bot.getInvite(code); - } catch (e) { - return null; - } - }) + inviteCodes.map(code => this.bot.getInvite(code).catch(() => null)) ); invites = invites.filter(v => !!v);