From c7a9fcd7c58761ac16718bb4fa18cdfd8c122b0a Mon Sep 17 00:00:00 2001 From: Bsian Date: Fri, 14 Aug 2020 20:23:50 +0100 Subject: [PATCH] better bug fix --- src/intervals/checkStaffStatus.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/intervals/checkStaffStatus.ts b/src/intervals/checkStaffStatus.ts index 83e6a4f..2bda989 100644 --- a/src/intervals/checkStaffStatus.ts +++ b/src/intervals/checkStaffStatus.ts @@ -6,16 +6,13 @@ export default function checkStaffStatus(client: Client) { const accounts = await client.db.Account.find(); for (const acc of accounts) { const tier3 = await client.db.Tier.findOne({ id: 3 }); - try { - await client.guilds.get('446067825673633794').getRESTMember(acc.userID); - } catch { - // eslint-disable-next-line no-unused-expressions - () => {}; - } - const user = client.guilds.get('446067825673633794').members.get(acc.userID); - // eslint-disable-next-line no-continue - if (!user) continue; + let user = client.guilds.get('446067825673633794').members.get(acc.userID); + try { + if (!user) user = await client.guilds.get('446067825673633794').getRESTMember(acc.userID); + } catch (error) { + continue; // eslint-disable-line no-continue + } if (!acc.permissions.director && user.roles.includes('662163685439045632')) { await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.director': true } }); if (acc.ramLimitNotification !== -1) {