catch error from role delete

so it doesn't break the loop
This commit is contained in:
Lamp 2019-04-19 04:31:11 +00:00
parent b1a35aabef
commit b69022e2b0
1 changed files with 7 additions and 2 deletions

View File

@ -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)
if (role.name.startsWith('[') && !role.members.size) {
try {
await role.delete();
} catch (e) {
console.error(e);
}
}
}
};