From 736b31bcc3081513c24e2e20b7ba96592bd0e256 Mon Sep 17 00:00:00 2001 From: Marco Crespi Date: Mon, 30 Mar 2020 14:48:36 +0200 Subject: [PATCH] fix(ranks): Fix fetching roles too often --- src/invites/services/Invites.ts | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/invites/services/Invites.ts b/src/invites/services/Invites.ts index fd14012f..917ff700 100644 --- a/src/invites/services/Invites.ts +++ b/src/invites/services/Invites.ts @@ -231,7 +231,6 @@ export class InvitesService extends IMService { const style = settings.rankAssignmentStyle; const allRanks = await this.client.cache.ranks.get(guild.id); - let allRoles: Role[] = []; // Return early if we don't have any ranks so we do not // get any permission issues for MANAGE_ROLES @@ -246,14 +245,7 @@ export class InvitesService extends IMService { const notReached: Role[] = []; for (const rank of allRanks) { - let role = guild.roles.get(rank.roleId); - - if (!role) { - if (!allRoles.length) { - allRoles = await guild.getRESTRoles(); - } - role = allRoles.find((r) => r.id === rank.roleId); - } + const role = guild.roles.get(rank.roleId); if (!role) { console.log(`ROLE ${rank.roleId} FOR RANK DOES NOT EXIST IN GUILD ${rank.guildId}`);