aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-26 18:43:13 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-26 18:43:13 -0400
commitef26d48c5767bb72721c30fe7aa75031a5f1534f (patch)
tree07a8f1c72eefcec6b748789259b98a5d0932d9bb /src
parentb2739a0bcec203f688a76a6e60e3a56de0b4357b (diff)
downloadtanzanite-ef26d48c5767bb72721c30fe7aa75031a5f1534f.tar.gz
tanzanite-ef26d48c5767bb72721c30fe7aa75031a5f1534f.tar.bz2
tanzanite-ef26d48c5767bb72721c30fe7aa75031a5f1534f.zip
fix(BushClientUtil): moderationPermissionCheck member undefined
Diffstat (limited to 'src')
-rw-r--r--src/lib/extensions/discord-akairo/BushClientUtil.ts14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts
index e8fe7fa..b35725d 100644
--- a/src/lib/extensions/discord-akairo/BushClientUtil.ts
+++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts
@@ -622,22 +622,26 @@ export class BushClientUtil extends ClientUtil {
checkModerator = true,
force = false
): true | string {
+ if (force) return true;
+
+ // If the victim is not in the guild anymore it will be undefined
+ if (!victim.guild && ['ban', 'unban'].includes(type)) return true;
+
if (moderator.guild.id !== victim.guild.id) {
throw 'moderator and victim not in same guild';
}
- if (force) return true;
const isOwner = moderator.guild.ownerId === moderator.id;
if (moderator.id === victim.id) {
- return `${this.client.util.emojis.error} You cannot ${type} yourself.`;
+ return `${util.emojis.error} You cannot ${type} yourself.`;
}
if (moderator.roles.highest.position <= victim.roles.highest.position && !isOwner) {
- return `${this.client.util.emojis.error} You cannot ${type} **${victim.user.tag}** because they have higher or equal role hierarchy as you do.`;
+ return `${util.emojis.error} You cannot ${type} **${victim.user.tag}** because they have higher or equal role hierarchy as you do.`;
}
if (victim.roles.highest.position >= victim.guild.me.roles.highest.position) {
- return `${this.client.util.emojis.error} You cannot ${type} **${victim.user.tag}** because they have higher or equal role hierarchy as I do.`;
+ return `${util.emojis.error} You cannot ${type} **${victim.user.tag}** because they have higher or equal role hierarchy as I do.`;
}
if (checkModerator && victim.permissions.has('MANAGE_MESSAGES')) {
- return `${this.client.util.emojis.error} You cannot ${type} **${victim.user.tag}** because they are a moderator.`;
+ return `${util.emojis.error} You cannot ${type} **${victim.user.tag}** because they are a moderator.`;
}
return true;
}