fix deleted role detection

This commit is contained in:
SowinskiBraeden committed 2024-01-22 20:57:30 -08:00
1 parent 9d9a764b1d
commit b396cd742b
2 files changed
+5 -6

No files matched your search

+4 -5
View File
@@ -271,10 +271,11 @@ class LinesPoliceCadBot extends Client {
if (!customRoleStatus) return false; // There is no role limits
// Clear any deleted roles
const guild = await this.guilds.cache.get(serverID);
let filteredRoles = [];
let update = false;
for (let i = 0; i < guild.server.allowedRoles.length; i++) {
let guildDB = this.dbo.collection.findOne({ 'server.serverID': serverID }).then(guildDB => guildDB)
for (let i = 0; i < guildDB.server.allowedRoles.length; i++) {
const guild = await this.guilds.cache.get(serverID);
const role = guild.roles.cache.find(role => role.id == guild.server.allowedRoles[i])
if (role) filteredRoles.push(role);
if (!role) update = true;
@@ -292,9 +293,7 @@ class LinesPoliceCadBot extends Client {
}
let hasRole = await this.checkRoleStatus(rolesCache, serverID, isList);
if (!hasRole) return false; // User does not have role
return true; // User has role
return hasRole;
}
log(Text) { this.logger.log(Text); }
+1 -1
View File
@@ -31,7 +31,7 @@ class Logger {
message:
`${d.getHours()}:${
d.getMInutes
} - ${d.getData()}:${d.getMonth()}:${d.getFullYear()} | Error: ` + Text,
} - ${d.getDate()}:${d.getMonth()}:${d.getFullYear()} | Error: ` + Text,
});
console.log(
colors.green(