fix deleted role detection
This commit is contained in:
1 parent
9d9a764b1d
commit
b396cd742b
2 files changed
+5
-6
No files matched your search
@@ -271,10 +271,11 @@ class LinesPoliceCadBot extends Client {
|
|||||||
if (!customRoleStatus) return false; // There is no role limits
|
if (!customRoleStatus) return false; // There is no role limits
|
||||||
|
|
||||||
// Clear any deleted roles
|
// Clear any deleted roles
|
||||||
const guild = await this.guilds.cache.get(serverID);
|
|
||||||
let filteredRoles = [];
|
let filteredRoles = [];
|
||||||
let update = false;
|
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])
|
const role = guild.roles.cache.find(role => role.id == guild.server.allowedRoles[i])
|
||||||
if (role) filteredRoles.push(role);
|
if (role) filteredRoles.push(role);
|
||||||
if (!role) update = true;
|
if (!role) update = true;
|
||||||
@@ -292,9 +293,7 @@ class LinesPoliceCadBot extends Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let hasRole = await this.checkRoleStatus(rolesCache, serverID, isList);
|
let hasRole = await this.checkRoleStatus(rolesCache, serverID, isList);
|
||||||
if (!hasRole) return false; // User does not have role
|
return hasRole;
|
||||||
|
|
||||||
return true; // User has role
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log(Text) { this.logger.log(Text); }
|
log(Text) { this.logger.log(Text); }
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ class Logger {
|
|||||||
message:
|
message:
|
||||||
`${d.getHours()}:${
|
`${d.getHours()}:${
|
||||||
d.getMInutes
|
d.getMInutes
|
||||||
} - ${d.getData()}:${d.getMonth()}:${d.getFullYear()} | Error: ` + Text,
|
} - ${d.getDate()}:${d.getMonth()}:${d.getFullYear()} | Error: ` + Text,
|
||||||
});
|
});
|
||||||
console.log(
|
console.log(
|
||||||
colors.green(
|
colors.green(
|
||||||
|
|||||||
Reference in new issue
Block a user