From 7043e8f259a2b35aa2603cae868b5fa0c931aadc Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Fri, 19 Aug 2022 15:52:30 +0300 Subject: [PATCH] catch promises --- src/structure/components/observers/UtilityHook.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/structure/components/observers/UtilityHook.js b/src/structure/components/observers/UtilityHook.js index 113a32f..1ea74e9 100644 --- a/src/structure/components/observers/UtilityHook.js +++ b/src/structure/components/observers/UtilityHook.js @@ -126,7 +126,7 @@ class UtilityHook extends Observer { // Sometimes the member isn't available on the API for some reason, // seeing if waiting a bit helps, so we don't try to patch a member that's still being processed on discord's API await Util.wait(5 * 1000); - await member.roles.add(roles, 'Adding autoroles').catch(this.logger.error.bind(this.logger)); + await member.roles.add(roles, 'Adding autoroles').catch(() => null); } @@ -137,9 +137,11 @@ class UtilityHook extends Observer { const setting = settings.welcomer; if (!setting.enabled || !setting.message) return; - const channel = await user.createDM(); + const channel = await user.createDM().catch(() => null); + if (!channel) return; + const message = this._replaceTags(setting.message, member); - await channel.send(message).catch(); + await channel.send(message).catch(() => null); }