From b69022e2b06374df0f6eee016f95cc03918449d6 Mon Sep 17 00:00:00 2001 From: Lamp Date: Fri, 19 Apr 2019 04:31:11 +0000 Subject: [PATCH] catch error from role delete so it doesn't break the loop --- src/colorroles.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/colorroles.js b/src/colorroles.js index f0b29d9..30600f4 100755 --- a/src/colorroles.js +++ b/src/colorroles.js @@ -73,8 +73,13 @@ colorRoles.pruneOrphanRoles = async function() { // delete all color roles that var guild = dClient.defaultGuild || dClient.guilds.get(config.guildID); for (let role of guild.roles) { role = role[1]; - if (role.name.startsWith('[') && !role.members.size) - await role.delete(); + if (role.name.startsWith('[') && !role.members.size) { + try { + await role.delete(); + } catch (e) { + console.error(e); + } + } } };