From 35d03eb54fe81c1d5c0359db67455b82f754e3f4 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Tue, 7 Sep 2021 20:15:45 -0400 Subject: add owner bypasses and prevent blacklisted users from having their dms logged --- src/lib/extensions/discord-akairo/BushClient.ts | 2 +- src/lib/extensions/discord.js/BushGuildMember.ts | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'src/lib') diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts index a1966e2..fbf3b5d 100644 --- a/src/lib/extensions/discord-akairo/BushClient.ts +++ b/src/lib/extensions/discord-akairo/BushClient.ts @@ -309,7 +309,7 @@ export class BushClient extends AkairoClient { - const ifShouldAddRole = this.#checkIfShouldAddRole(options.role); + const ifShouldAddRole = this.#checkIfShouldAddRole(options.role, options.moderator); if (ifShouldAddRole !== true) return ifShouldAddRole; let caseID: string | undefined = undefined; @@ -190,7 +190,7 @@ export class BushGuildMember extends GuildMember { } public async removeRole(options: RemoveRoleOptions): Promise { - const ifShouldAddRole = this.#checkIfShouldAddRole(options.role); + const ifShouldAddRole = this.#checkIfShouldAddRole(options.role, options.moderator); if (ifShouldAddRole !== true) return ifShouldAddRole; let caseID: string | undefined = undefined; @@ -240,8 +240,12 @@ export class BushGuildMember extends GuildMember { return ret; } - #checkIfShouldAddRole(role: BushRole | Role): true | 'user hierarchy' | 'role managed' | 'client hierarchy' { - if (this.roles.highest.position <= role.position && this.guild.ownerId !== this.id) { + #checkIfShouldAddRole( + role: BushRole | Role, + moderator?: BushGuildMember + ): true | 'user hierarchy' | 'role managed' | 'client hierarchy' { + if (moderator && moderator.roles.highest.position <= role.position /* && this.guild.ownerId !== this.id */) { + client.console.debug(`${this.roles.highest.position} <= ${role.position}`); return 'user hierarchy'; } else if (role.managed) { return 'role managed'; -- cgit