forked from Galactic/galactic-bot
fix bug?
This commit is contained in:
parent
93861b1309
commit
d0b64dd501
@ -46,23 +46,17 @@ class AddroleInfraction extends Infraction {
|
||||
|
||||
async verify() {
|
||||
|
||||
const missingAdministrator = this.channel.permissionsFor(this.guild.me).missing(['ADMINISTRATOR']);
|
||||
let filtered = [];
|
||||
const { highest: clientHighest } = this.guild.me.roles;
|
||||
filtered = this.data.roles.filter((r) => r.comparePositionTo(clientHighest) < 0);
|
||||
console.log("Filtered roles (client)...", filtered.map((r) => r.name).join(', '));
|
||||
if(filtered.length === 0) {
|
||||
return super._fail('C_ADDROLE_ROLEHIERARCHYBOT');
|
||||
}
|
||||
|
||||
if(missingAdministrator.length > 0) {
|
||||
const { highest: memberHighest } = this.executorMember.roles;
|
||||
console.log(memberHighest.map((r) => r.name));
|
||||
filtered = this.data.roles.filter((r) => r.comparePositionTo(memberHighest) < 0);
|
||||
console.log("Filtered roles (member)...", filtered.map((r) => r.name).join(', '));
|
||||
if(filtered.length === 0) {
|
||||
return super._fail('C_ADDROLE_ROLEHIERARCHY');
|
||||
}
|
||||
const { highest: memberHighest } = this.executorMember.roles;
|
||||
filtered = this.data.roles.filter((r) => r.comparePositionTo(memberHighest) < 0);
|
||||
if(filtered.length === 0) {
|
||||
return super._fail('C_ADDROLE_ROLEHIERARCHY');
|
||||
}
|
||||
|
||||
this.data.roles = filtered;
|
||||
|
Loading…
Reference in New Issue
Block a user