optimisations!!!!!
diff --git a/src/commands/mod/ban.ts b/src/commands/mod/ban.ts
index 7861cdd..1e17e53 100644
--- a/src/commands/mod/ban.ts
+++ b/src/commands/mod/ban.ts
@@ -127,7 +127,7 @@
// Check if Nucleus can ban the member
if (! (mePos > applyPos)) throw "I do not have a role higher than that member"
// Check if Nucleus has permission to ban
- if (! interaction.guild.me.permissions.has("BAN_MEMBERS")) throw "I do not have the `ban_members` permission";
+ if (! me.permissions.has("BAN_MEMBERS")) throw "I do not have the `ban_members` permission";
// Do not allow banning Nucleus
if (member.id == interaction.guild.me.id) throw "I cannot ban myself"
// Allow the owner to ban anyone
diff --git a/src/commands/mod/kick.ts b/src/commands/mod/kick.ts
index 9d434f8..9dc447b 100644
--- a/src/commands/mod/kick.ts
+++ b/src/commands/mod/kick.ts
@@ -124,7 +124,7 @@
// Check if Nucleus can kick the member
if (! (mePos > applyPos)) throw "I do not have a role higher than that member"
// Check if Nucleus has permission to kick
- if (! interaction.guild.me.permissions.has("KICK_MEMBERS")) throw "I do not have the `kick_members` permission";
+ if (! me.permissions.has("KICK_MEMBERS")) throw "I do not have the `kick_members` permission";
// Do not allow kicking Nucleus
if (member.id == interaction.guild.me.id) throw "I cannot kick myself"
// Allow the owner to kick anyone
diff --git a/src/commands/mod/mute.ts b/src/commands/mod/mute.ts
index 3c4544e..d81a5cc 100644
--- a/src/commands/mod/mute.ts
+++ b/src/commands/mod/mute.ts
@@ -225,11 +225,11 @@
// Check if Nucleus can mute the member
if (! (mePos > applyPos)) throw "I do not have a role higher than that member"
// Check if Nucleus has permission to mute
- if (! interaction.guild.me.permissions.has("MODERATE_MEMBERS")) throw "I do not have the `moderate_members` permission";
+ if (! me.permissions.has("MODERATE_MEMBERS")) throw "I do not have the `moderate_members` permission";
// Do not allow the user to have admin or be the owner
- if ((interaction.options.getMember("user") as GuildMember).permissions.has("ADMINISTRATOR") || (interaction.options.getMember("user") as GuildMember).id == interaction.guild.ownerId) throw "You cannot mute an admin or the owner"
+ if (apply.permissions.has("ADMINISTRATOR") || (interaction.options.getMember("user") as GuildMember).id == interaction.guild.ownerId) throw "You cannot mute an admin or the owner"
// Do not allow muting Nucleus
- if (member.id == interaction.guild.me.id) throw "I cannot mute myself"
+ if (member.id == me.id) throw "I cannot mute myself"
// Allow the owner to mute anyone
if (member.id == interaction.guild.ownerId) return true
// Check if the user has moderate_members permission
diff --git a/src/commands/mod/nick.ts b/src/commands/mod/nick.ts
index 1e57e01..cd3a7af 100644
--- a/src/commands/mod/nick.ts
+++ b/src/commands/mod/nick.ts
@@ -120,7 +120,7 @@
// Check if Nucleus can change the nickname
if (! (mePos > applyPos)) throw "I do not have a role higher than that member"
// Check if Nucleus has permission to change the nickname
- if (! interaction.guild.me.permissions.has("MANAGE_NICKNAMES")) throw "I do not have the `manage_nicknames` permission";
+ if (! me.permissions.has("MANAGE_NICKNAMES")) throw "I do not have the `manage_nicknames` permission";
// Allow the owner to change anyone's nickname
if (member.id == interaction.guild.ownerId) return true
// Check if the user has manage_nicknames permission
diff --git a/src/commands/mod/purge.ts b/src/commands/mod/purge.ts
index 7a35e5b..e388ea0 100644
--- a/src/commands/mod/purge.ts
+++ b/src/commands/mod/purge.ts
@@ -309,12 +309,13 @@
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
let member = (interaction.member as GuildMember)
+ let me = (interaction.guild.me as GuildMember)
// Allow the owner to purge
if (member.id == interaction.guild.ownerId) return true
// Check if the user has manage_messages permission
if (! member.permissions.has("MANAGE_MESSAGES")) throw "You do not have the `manage_messages` permission";
// Check if nucleus has the manage_messages permission
- if (! interaction.guild.me.permissions.has("MANAGE_MESSAGES")) throw "I do not have the `manage_messages` permission";
+ if (! me.permissions.has("MANAGE_MESSAGES")) throw "I do not have the `manage_messages` permission";
// Allow warn
return true
}
diff --git a/src/commands/mod/slowmode.ts b/src/commands/mod/slowmode.ts
index 8bec805..0000844 100644
--- a/src/commands/mod/slowmode.ts
+++ b/src/commands/mod/slowmode.ts
@@ -59,7 +59,7 @@
let member = (interaction.member as GuildMember)
let me = (interaction.guild.me as GuildMember)
// Check if Nucleus can edit the channel
- if (! interaction.guild.me.permission.has("MANAGE_CHANNELS")) throw "I do not have permission to edit this channel"
+ if (! me.permission.has("MANAGE_CHANNELS")) throw "I do not have permission to edit this channel"
// Allow the owner to set any channel
if (member.id == interaction.guild.ownerId) return true
// Check if the user has manage_channels permission
diff --git a/src/commands/mod/softban.ts b/src/commands/mod/softban.ts
index 334f7f2..f8fedda 100644
--- a/src/commands/mod/softban.ts
+++ b/src/commands/mod/softban.ts
@@ -98,11 +98,11 @@
// Check if Nucleus can ban the member
if (! (mePos > applyPos)) throw "I do not have a role higher than that member"
// Check if Nucleus has permission to ban
- if (! interaction.guild.me.permissions.has("BAN_MEMBERS")) throw "I do not have the `ban_members` permission";
+ if (!me.permissions.has("BAN_MEMBERS")) throw "I do not have the `ban_members` permission";
// Do not allow softbanning Nucleus
- if (member.id == interaction.guild.me.id) throw "I cannot softban myself"
+ if (member.id == me.id) throw "I cannot softban myself"
// Allow the owner to ban anyone
- if (member.id == interaction.guild.ownerId) return true
+ if (member.id == ownerId) return true
// Check if the user has ban_members permission
if (! member.permissions.has("BAN_MEMBERS")) throw "You do not have the `ban_members` permission";
// Check if the user is below on the role list
diff --git a/src/commands/mod/unban.ts b/src/commands/mod/unban.ts
index 8ea3ec1..8231752 100644
--- a/src/commands/mod/unban.ts
+++ b/src/commands/mod/unban.ts
@@ -90,7 +90,7 @@
let member = (interaction.member as GuildMember)
let me = (interaction.guild.me as GuildMember)
// Check if Nucleus can unban members
- if (! interaction.guild.me.permissions.has("BAN_MEMBERS")) throw "I do not have the `ban_members` permission";
+ if (! me.permissions.has("BAN_MEMBERS")) throw "I do not have the `ban_members` permission";
// Allow the owner to unban anyone
if (member.id == interaction.guild.ownerId) return true
// Check if the user has ban_members permission
diff --git a/src/commands/mod/unmute.ts b/src/commands/mod/unmute.ts
index 163c059..b2f8234 100644
--- a/src/commands/mod/unmute.ts
+++ b/src/commands/mod/unmute.ts
@@ -87,9 +87,9 @@
// Check if Nucleus can unmute the member
if (! (mePos > applyPos)) throw "I do not have a role higher than that member"
// Check if Nucleus has permission to unmute
- if (! interaction.guild.me.permissions.has("MODERATE_MEMBERS")) throw "I do not have the `moderate_members` permission";
+ if (! me.permissions.has("MODERATE_MEMBERS")) throw "I do not have the `moderate_members` permission";
// Do not allow the user to have admin or be the owner
- if ((interaction.options.getMember("user") as GuildMember).permissions.has("ADMINISTRATOR") || (interaction.options.getMember("user") as GuildMember).id == interaction.guild.ownerId) throw "You cannot unmute an admin or the owner"
+ if (apply.permissions.has("ADMINISTRATOR") || apply.id == interaction.guild.ownerId) throw "You cannot unmute an admin or the owner"
// Allow the owner to unmute anyone
if (member.id == interaction.guild.ownerId) return true
// Check if the user has moderate_members permission
diff --git a/src/commands/mod/unnamed.ts b/src/commands/mod/unnamed.ts
index 4c6a31e..20ebc30 100644
--- a/src/commands/mod/unnamed.ts
+++ b/src/commands/mod/unnamed.ts
@@ -215,11 +215,11 @@
// Check if Nucleus can UNNAMED the member
if (! (mePos > applyPos)) throw "I do not have a role higher than that member"
// Check if Nucleus has permission to UNNAMED
- if (! interaction.guild.me.permissions.has("MANAGE_ROLES")) throw "I do not have the `manage_roles` permission";
+ if (! me.permissions.has("MANAGE_ROLES")) throw "I do not have the `manage_roles` permission";
// Do not allow the user to have admin or be the owner
- if ((interaction.options.getMember("user") as GuildMember).permissions.has("ADMINISTRATOR") || (interaction.options.getMember("user") as GuildMember).id == interaction.guild.ownerId) throw "You cannot mute an admin or the owner"
+ if (apply.permissions.has("ADMINISTRATOR") || apply.id == interaction.guild.ownerId) throw "You cannot mute an admin or the owner"
// Do not allow muting Nucleus
- if (member.id == interaction.guild.me.id) throw "I cannot UNNAMED myself"
+ if (member.id == me.id) throw "I cannot UNNAMED myself"
// Allow the owner to UNNAMED anyone
if (member.id == interaction.guild.ownerId) return true
// Check if the user has moderate_members permission