purge work and general fixes
diff --git a/src/commands/mod/ban.ts b/src/commands/mod/ban.ts
index 1a27a2d..2d7d036 100644
--- a/src/commands/mod/ban.ts
+++ b/src/commands/mod/ban.ts
@@ -33,9 +33,10 @@
 //        const pluralize = (word: string, count: number) => { return count === 1 ? word : word + "s" }
     .send()) {
         let dmd = false
+        let dm;
         try {
             if (interaction.options.getString("notify") != "no") {
-                await (interaction.options.getMember("user") as GuildMember).send({
+                dm = await (interaction.options.getMember("user") as GuildMember).send({
                     embeds: [new EmojiEmbed()
                         .setEmoji("PUNISH.BAN.RED")
                         .setTitle("Banned")
@@ -52,13 +53,6 @@
                 days: Number(interaction.options.getInteger("delete") ?? 0),
                 reason: interaction.options.getString("reason") ?? "No reason provided"
             })
-            let failed = (dmd == false && interaction.options.getString("notify") != "no")
-            await interaction.editReply({embeds: [new EmojiEmbed()
-                .setEmoji(`PUNISH.BAN.${failed ? "YELLOW" : "GREEN"}`)
-                .setTitle(`Ban`)
-                .setDescription("The member was banned" + (failed ? ", but could not be notified" : ""))
-                .setStatus(failed ? "Warning" : "Success")
-            ], components: []})
         } catch {
             await interaction.editReply({embeds: [new EmojiEmbed()
                 .setEmoji("PUNISH.BAN.RED")
@@ -66,7 +60,16 @@
                 .setDescription("Something went wrong and the user was not banned")
                 .setStatus("Danger")
             ], components: []})
+            if (dmd) await dm.delete()
+            return
         }
+        let failed = (dmd == false && interaction.options.getString("notify") != "no")
+        await interaction.editReply({embeds: [new EmojiEmbed()
+            .setEmoji(`PUNISH.BAN.${failed ? "YELLOW" : "GREEN"}`)
+            .setTitle(`Ban`)
+            .setDescription("The member was banned" + (failed ? ", but could not be notified" : ""))
+            .setStatus(failed ? "Warning" : "Success")
+        ], components: []})
     } else {
         await interaction.editReply({embeds: [new EmojiEmbed()
             .setEmoji("PUNISH.BAN.GREEN")
@@ -78,8 +81,15 @@
 }
 
 const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+    let member = (interaction.member as GuildMember)
+    let me = (interaction.guild.me as GuildMember)
+    let apply = (interaction.options.getMember("user") as GuildMember)
+    if (member == null || me == null || apply == null) throw "That member is not in the server"
+    let memberPos = member.roles ? member.roles.highest.position : 0
+    let mePos = me.roles ? me.roles.highest.position : 0
+    let applyPos = apply.roles ? apply.roles.highest.position : 0
     // Check if Nucleus can ban the member
-    if (! (interaction.guild.me.roles.highest.position > (interaction.member as GuildMember).roles.highest.position)) throw "I do not have a role higher than that 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";
     // Do not allow banning Nucleus
@@ -89,7 +99,7 @@
     // Check if the user has ban_members permission
     if (! (interaction.member as GuildMember).permissions.has("BAN_MEMBERS")) throw "You do not have the `ban_members` permission";
     // Check if the user is below on the role list
-    if (! ((interaction.member as GuildMember).roles.highest.position > (interaction.options.getMember("user") as GuildMember).roles.highest.position)) throw "You do not have a role higher than that member"
+    if (! (memberPos > applyPos)) throw "You do not have a role higher than that member"
     // Allow ban
     return true
 }