From d7ef54efee828674d13094a131baf10084202092 Mon Sep 17 00:00:00 2001 From: kry008 Date: Sun, 16 Jun 2024 11:16:56 +0200 Subject: [PATCH] error check, if yes remove hello and goodbye --- events/newMember.js | 8 +++++++- events/removeMember.js | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/events/newMember.js b/events/newMember.js index 384b18c..5b2236d 100644 --- a/events/newMember.js +++ b/events/newMember.js @@ -49,7 +49,13 @@ module.exports = { console.error("Welcome channel not found."); } }) - .catch(console.error); + .catch( + //if the channel is not found, set the welcome channel to null and hello to false + data.helloChannel = null, + data.hello = false, + fs.writeFileSync(filePath, JSON.stringify(data)) + + ); } else { return; } diff --git a/events/removeMember.js b/events/removeMember.js index 5cc9056..27dc88b 100644 --- a/events/removeMember.js +++ b/events/removeMember.js @@ -32,7 +32,11 @@ module.exports = { console.error("Goodbye channel not found."); } }) - .catch(console.error); + .catch( + data.goodbyeChannel = null, + data.goodbye = false, + fs.writeFileSync(filePath, JSON.stringify(data)) + ); } else {