diff --git a/src/actions/createModActionTicket.ts b/src/actions/createModActionTicket.ts
index 40f99b9..72ba011 100644
--- a/src/actions/createModActionTicket.ts
+++ b/src/actions/createModActionTicket.ts
@@ -16,7 +16,7 @@
         deny: ["VIEW_CHANNEL"],
         type: "role"
     })
-    if (config.tickets.supportRole != null) {
+    if (config.tickets.supportRole !== null) {
         overwrites.push({
             id: guild.roles.cache.get(config.tickets.supportRole),
             allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ATTACH_FILES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"],
@@ -40,10 +40,10 @@
     try {
         await c.send(
             {
-                content: (`<@${member.id}>` + (config.tickets.supportRole != null ? ` • <@&${config.tickets.supportRole}>` : "")),
+                content: (`<@${member.id}>` + (config.tickets.supportRole !== null ? ` • <@&${config.tickets.supportRole}>` : "")),
                 allowedMentions: {
                     users: [member.id],
-                    roles: (config.tickets.supportRole != null ? [config.tickets.supportRole] : [])
+                    roles: (config.tickets.supportRole !== null ? [config.tickets.supportRole] : [])
                 }
             }
         )
@@ -51,7 +51,7 @@
             .setTitle("New Ticket")
             .setDescription(
                 `Ticket created by a Moderator\n` +
-                `**Support type:** Appeal submission\n` + (reason != null ? `**Reason:**\n> ${reason}\n` : "") +
+                `**Support type:** Appeal submission\n` + (reason !== null ? `**Reason:**\n> ${reason}\n` : "") +
                 `**Ticket ID:** \`${c.id}\`\n` +
                 `Type \`/ticket close\` to close this ticket.`,
             )
diff --git a/src/actions/roleMenu.ts b/src/actions/roleMenu.ts
index a4397a3..7432a3a 100644
--- a/src/actions/roleMenu.ts
+++ b/src/actions/roleMenu.ts
@@ -3,6 +3,7 @@
 import { MessageActionRow, MessageSelectMenu } from 'discord.js';
 import getEmojiByName from "../utils/getEmojiByName.js";
 import client from "../utils/client.js";
+import { LoadingEmbed } from "../utils/defaultEmbeds.js";
 
 export async function callback(interaction) {
     let config = await client.database.guilds.read(interaction.guild.id);
@@ -18,12 +19,7 @@
         .setStatus("Danger")
         .setEmoji("CONTROL.BLOCKCROSS")
     ], ephemeral: true})
-    await interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Roles")
-        .setDescription("Loading...")
-        .setStatus("Success")
-        .setEmoji("NUCLEUS.LOADING")
-    ], ephemeral: true})
+    await interaction.reply({embeds: LoadingEmbed, ephemeral: true})
     let m;
     if (config.roleMenu.allowWebUI) {
         let code = ""
@@ -54,7 +50,7 @@
         let up = true
         try {
             let status = await fetch(client.config.baseUrl).then(res => res.status);
-            if (status != 200) up = false
+            if (status !== 200) up = false
         } catch { up = false }
         m = await interaction.editReply({
             embeds: [new EmojiEmbed()
@@ -88,7 +84,7 @@
                     .setTitle("Roles")
                     .setEmoji("GUILD.GREEN")
                     .setDescription(`**${object.name}**` + (object.description ? `\n${object.description}` : ``) +
-                        `\n\nSelect ${object.min}` + (object.min != object.max ? ` to ${object.max}` : ``) + ` role${object.max == 1 ? '' : 's'} to add.`)
+                        `\n\nSelect ${object.min}` + (object.min !== object.max ? ` to ${object.max}` : ``) + ` role${object.max === 1 ? '' : 's'} to add.`)
                     .setStatus("Success")
                     .setFooter({text: `Step ${i + 1}/${config.roleMenu.options.length}`})
             ],
@@ -99,7 +95,7 @@
                         .setStyle("DANGER")
                         .setCustomId("cancel")
                         .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
-                    ].concat(object.min == 0 ? [
+                    ].concat(object.min === 0 ? [
                         new MessageButton()
                             .setLabel("Skip")
                             .setStyle("SECONDARY")
@@ -121,9 +117,9 @@
             return
         }
         component.deferUpdate()
-        if (component.customId == "rolemenu") {
+        if (component.customId === "rolemenu") {
             rolesToAdd = rolesToAdd.concat(component.values)
-        } else if (component.customId == "cancel") {
+        } else if (component.customId === "cancel") {
             return await interaction.editReply({embeds: [new EmojiEmbed()
                 .setTitle("Roles")
                 .setDescription("Cancelled. No changes were made.")
diff --git a/src/actions/tickets/create.ts b/src/actions/tickets/create.ts
index e21aa3e..722eb3f 100644
--- a/src/actions/tickets/create.ts
+++ b/src/actions/tickets/create.ts
@@ -24,7 +24,7 @@
     let category = interaction.guild.channels.cache.get(config.tickets.category) as Discord.CategoryChannel;
     let count = 0;
     category.children.forEach(element => {
-        if (!(element.type == "GUILD_TEXT")) return;
+        if (!(element.type === "GUILD_TEXT")) return;
         if ((element as Discord.TextChannel).topic.includes(`${interaction.member.user.id}`)) {
             if ((element as Discord.TextChannel).topic.endsWith("Active")) {
                 count++;
@@ -84,13 +84,13 @@
             if (custom) {
                 return new MessageButton()
                     .setLabel(type)
-                    .setStyle(chosenType == type ? "SUCCESS" : "SECONDARY")
+                    .setStyle(chosenType === type ? "SUCCESS" : "SECONDARY")
                     .setCustomId(type)
                     .setDisabled(true)
                 } else {
                     return new MessageButton()
                     .setLabel(capitalize(type))
-                    .setStyle(chosenType == type ? "SUCCESS" : "SECONDARY")
+                    .setStyle(chosenType === type ? "SUCCESS" : "SECONDARY")
                     .setCustomId(type)
                     .setEmoji(getEmojiByName(("TICKETS." + type.toString().toUpperCase()), "id"))
                     .setDisabled(true)
@@ -122,7 +122,7 @@
         deny: ["VIEW_CHANNEL"],
         type: "role"
     })
-    if (config.tickets.supportRole != null) {
+    if (config.tickets.supportRole !== null) {
         overwrites.push({
             id: interaction.guild.roles.cache.get(config.tickets.supportRole),
             allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ATTACH_FILES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"],
@@ -151,10 +151,10 @@
     try {
         await c.send(
             {
-                content: (`<@${interaction.member.user.id}>` + (config.tickets.supportRole != null ? ` • <@&${config.tickets.supportRole}>` : "")),
+                content: (`<@${interaction.member.user.id}>` + (config.tickets.supportRole !== null ? ` • <@&${config.tickets.supportRole}>` : "")),
                 allowedMentions: {
                     users: [(interaction.member as Discord.GuildMember).id],
-                    roles: (config.tickets.supportRole != null ? [config.tickets.supportRole] : [])
+                    roles: (config.tickets.supportRole !== null ? [config.tickets.supportRole] : [])
                 }
             }
         )
@@ -165,7 +165,7 @@
             .setTitle("New Ticket")
             .setDescription(
                 `Ticket created by <@${interaction.member.user.id}>\n` +
-                `**Support type:** ${chosenType != null ? (emoji) + " " + capitalize(chosenType) : "General"}\n` +
+                `**Support type:** ${chosenType !== null ? (emoji) + " " + capitalize(chosenType) : "General"}\n` +
                 `**Ticket ID:** \`${c.id}\`\n${content}\n` +
                 `Type \`/ticket close\` to close this ticket.`,
             )
diff --git a/src/actions/tickets/delete.ts b/src/actions/tickets/delete.ts
index c14cf0c..d86396a 100644
--- a/src/actions/tickets/delete.ts
+++ b/src/actions/tickets/delete.ts
@@ -10,7 +10,7 @@
     let thread = false; let threadChannel
     if (interaction.channel instanceof Discord.ThreadChannel) thread = true; threadChannel = interaction.channel as Discord.ThreadChannel
     let channel = (interaction.channel as Discord.TextChannel)
-    if (!channel.parent || config.tickets.category != channel.parent.id || (thread ? (threadChannel.parent.parent.id != config.tickets.category) : false)) {
+    if (!channel.parent || config.tickets.category !== channel.parent.id || (thread ? (threadChannel.parent.parent.id !== config.tickets.category) : false)) {
         return interaction.reply({embeds: [new EmojiEmbed()
             .setTitle("Deleting Ticket...")
             .setDescription("This ticket is not in your tickets category, so cannot be deleted. You cannot run close in a thread.")
@@ -19,7 +19,7 @@
         ], ephemeral: true});
     }
     let status = channel.topic.split(" ")[1];
-    if (status == "Archived") {
+    if (status === "Archived") {
         await interaction.reply({embeds: [new EmojiEmbed()
             .setTitle("Delete Ticket")
             .setDescription("Your ticket is being deleted...")
@@ -47,7 +47,7 @@
         log(data);
         interaction.channel.delete();
         return;
-    } else if (status == "Active") {
+    } else if (status === "Active") {
         await interaction.reply({embeds: [new EmojiEmbed()
             .setTitle("Close Ticket")
             .setDescription("Your ticket is being closed...")
@@ -66,7 +66,7 @@
                 type: "role"
             }
         ] as Discord.OverwriteResolvable[];
-        if (config.tickets.supportRole != null) {
+        if (config.tickets.supportRole !== null) {
             overwrites.push({
                 id: interaction.guild.roles.cache.get(config.tickets.supportRole),
                 allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ATTACH_FILES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"],
@@ -127,8 +127,8 @@
     let ticketChannels = tickets.children;
     let deleted = 0
     ticketChannels.forEach(element => {
-        if (element.type != "GUILD_TEXT") return;
-        if (element.topic.split(" ")[0] == member) {
+        if (element.type !== "GUILD_TEXT") return;
+        if (element.topic.split(" ")[0] === member) {
             try { element.delete(); } catch {}
             deleted++
         }
