diff --git a/src/actions/createModActionTicket.ts b/src/actions/createModActionTicket.ts
index 7bd3d22..1d3406d 100644
--- a/src/actions/createModActionTicket.ts
+++ b/src/actions/createModActionTicket.ts
@@ -1,12 +1,12 @@
-import Discord, { MessageActionRow, MessageButton } from 'discord.js';
-import EmojiEmbed from '../utils/generateEmojiEmbed.js';
+import Discord, { MessageActionRow, MessageButton } from "discord.js";
+import EmojiEmbed from "../utils/generateEmojiEmbed.js";
 import getEmojiByName from "../utils/getEmojiByName.js";
 import client from "../utils/client.js";
 
 export async function create(guild: Discord.Guild, member: Discord.User, createdBy: Discord.User, reason: string, customReason?: string) {
-    let config = await client.database.guilds.read(guild.id);
-    const { log, NucleusColors, entry, renderUser, renderChannel, renderDelta } = client.logger
-    let overwrites = [{
+    const config = await client.database.guilds.read(guild.id);
+    const { log, NucleusColors, entry, renderUser, renderChannel, renderDelta } = client.logger;
+    const overwrites = [{
         id: member,
         allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ATTACH_FILES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"],
         type: "member"
@@ -15,13 +15,13 @@
         id: guild.roles.everyone,
         deny: ["VIEW_CHANNEL"],
         type: "role"
-    })
+    });
     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"],
             type: "role"
-        })
+        });
     }
 
     let c;
@@ -33,9 +33,9 @@
             nsfw: false,
             permissionOverwrites: (overwrites as Discord.OverwriteResolvable[]),
             reason: "Creating ticket"
-        })
+        });
     } catch (e) {
-        return null
+        return null;
     }
     try {
         await c.send(
@@ -46,14 +46,14 @@
                     roles: (config.tickets.supportRole !== null ? [config.tickets.supportRole] : [])
                 }
             }
-        )
+        );
         await c.send({ embeds: [new EmojiEmbed()
             .setTitle("New Ticket")
             .setDescription(
-                `Ticket created by a Moderator\n` +
+                "Ticket created by a Moderator\n" +
                 `**Support type:** ${customReason ? customReason : "Appeal submission"}\n` + (reason !== null ? `**Reason:**\n> ${reason}\n` : "") +
                 `**Ticket ID:** \`${c.id}\`\n` +
-                `Type \`/ticket close\` to close this ticket.`,
+                "Type `/ticket close` to close this ticket."
             )
             .setStatus("Success")
             .setEmoji("GUILD.TICKET.OPEN")
@@ -62,32 +62,32 @@
             .setStyle("DANGER")
             .setCustomId("closeticket")
             .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
-        ])]})
-        let data = {
+        ])]});
+        const data = {
             meta:{
-                type: 'ticketCreate',
-                displayName: 'Ticket Created',
+                type: "ticketCreate",
+                displayName: "Ticket Created",
                 calculateType: "ticketUpdate",
                 color: NucleusColors.green,
-                emoji: 'GUILD.TICKET.OPEN',
+                emoji: "GUILD.TICKET.OPEN",
                 timestamp: new Date().getTime()
             },
             list: {
                 ticketFor: entry(member.id, renderUser(member)),
                 createdBy: entry(createdBy.id, renderUser(createdBy)),
                 created: entry(new Date().getTime(), renderDelta(new Date().getTime())),
-                ticketChannel: entry(c.id, renderChannel(c)),
+                ticketChannel: entry(c.id, renderChannel(c))
             },
             hidden: {
                 guild: guild.id
             }
-        }
+        };
         log(data);
-    } catch (e) { console.log(e); return null }
-    return c.id
+    } catch (e) { console.log(e); return null; }
+    return c.id;
 }
 
 export async function areTicketsEnabled(guild: string) {
-    let config = await client.database.guilds.read(guild);
+    const config = await client.database.guilds.read(guild);
     return config.tickets.enabled;
 }
\ No newline at end of file
diff --git a/src/actions/roleMenu.ts b/src/actions/roleMenu.ts
index 21e97ec..6fd73ac 100644
--- a/src/actions/roleMenu.ts
+++ b/src/actions/roleMenu.ts
@@ -1,42 +1,43 @@
 import { Message, MessageButton } from "discord.js";
-import EmojiEmbed from '../utils/generateEmojiEmbed.js'
-import { MessageActionRow, MessageSelectMenu } from 'discord.js';
+import EmojiEmbed from "../utils/generateEmojiEmbed.js";
+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);
+    const config = await client.database.guilds.read(interaction.guild.id);
     if (!config.roleMenu.enabled) return await interaction.reply({embeds: [new EmojiEmbed()
         .setTitle("Roles")
         .setDescription("Self roles are currently disabled. Please contact a staff member or try again later.")
         .setStatus("Danger")
         .setEmoji("CONTROL.BLOCKCROSS")
-    ], ephemeral: true})
+    ], ephemeral: true});
     if (config.roleMenu.options.length === 0) return await interaction.reply({embeds: [new EmojiEmbed()
         .setTitle("Roles")
         .setDescription("There are no roles available. Please contact a staff member or try again later.")
         .setStatus("Danger")
         .setEmoji("CONTROL.BLOCKCROSS")
-    ], ephemeral: true})
-    await interaction.reply({embeds: LoadingEmbed, ephemeral: true})
+    ], ephemeral: true});
+    await interaction.reply({embeds: LoadingEmbed, ephemeral: true});
     let m;
     if (config.roleMenu.allowWebUI) {
-        let code = ""
-        let length = 5
-        let itt = 0
+        let code = "";
+        let length = 5;
+        let itt = 0;
         const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
-        while (true) {
-            itt += 1
-            code = ""
+        let valid = false;
+        while (!valid) {
+            itt += 1;
+            code = "";
             for (let i = 0; i < length; i++) { code += chars.charAt(Math.floor(Math.random() * chars.length)); }
             if (code in client.roleMenu) continue;
             if (itt > 1000) {
-                itt = 0
-                length += 1
+                itt = 0;
+                length += 1;
                 continue;
             }
-            break;
+            valid = true;
         }
         client.roleMenu[code] = {
             guild: interaction.guild.id,
@@ -47,11 +48,11 @@
             data: config.roleMenu.options,
             interaction: interaction
         };
-        let up = true
+        let up = true;
         try {
-            let status = await fetch(client.config.baseUrl).then(res => res.status);
-            if (status !== 200) up = false
-        } catch { up = false }
+            const status = await fetch(client.config.baseUrl).then(res => res.status);
+            if (status !== 200) up = false;
+        } catch { up = false; }
         m = await interaction.editReply({
             embeds: [new EmojiEmbed()
                 .setTitle("Roles")
@@ -69,22 +70,22 @@
                     .setStyle("PRIMARY")
                     .setCustomId("manual")
             ])]
-        })
+        });
     }
     let component;
     try { component = await (m as Message).awaitMessageComponent({time: 300000});
-    } catch (e) { return }
-    component.deferUpdate()
-    let rolesToAdd = []
+    } catch (e) { return; }
+    component.deferUpdate();
+    let rolesToAdd = [];
     for (let i = 0; i < config.roleMenu.options.length; i++) {
-        let object = config.roleMenu.options[i];
-        let m = await interaction.editReply({
+        const object = config.roleMenu.options[i];
+        const m = await interaction.editReply({
             embeds: [
                 new EmojiEmbed()
                     .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.`)
+                    .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.`)
                     .setStatus("Success")
                     .setFooter({text: `Step ${i + 1}/${config.roleMenu.options.length}`})
             ],
@@ -95,59 +96,59 @@
                         .setStyle("DANGER")
                         .setCustomId("cancel")
                         .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
-                    ].concat(object.min === 0 ? [
-                        new MessageButton()
-                            .setLabel("Skip")
-                            .setStyle("SECONDARY")
-                            .setCustomId("skip")
-                            .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
-                        ] : []))
+                ].concat(object.min === 0 ? [
+                    new MessageButton()
+                        .setLabel("Skip")
+                        .setStyle("SECONDARY")
+                        .setCustomId("skip")
+                        .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
+                ] : []))
             ].concat([new MessageActionRow().addComponents([new MessageSelectMenu()
                 .setPlaceholder(`${object.name}`)
                 .setCustomId("rolemenu")
                 .setMinValues(object.min)
                 .setMaxValues(object.max)
-                .setOptions(object.options.map(o => { return {label: o.name, description: o.description, value: o.role} }))
+                .setOptions(object.options.map(o => { return {label: o.name, description: o.description, value: o.role}; }))
             ])])
         });
         let component;
         try {
             component = await (m as Message).awaitMessageComponent({time: 300000});
         } catch (e) {
-            return
+            return;
         }
-        component.deferUpdate()
+        component.deferUpdate();
         if (component.customId === "rolemenu") {
-            rolesToAdd = rolesToAdd.concat(component.values)
+            rolesToAdd = rolesToAdd.concat(component.values);
         } else if (component.customId === "cancel") {
             return await interaction.editReply({embeds: [new EmojiEmbed()
                 .setTitle("Roles")
                 .setDescription("Cancelled. No changes were made.")
                 .setStatus("Danger")
                 .setEmoji("GUILD.RED")
-            ], components: []})
+            ], components: []});
         }
     }
-    let rolesToRemove = config.roleMenu.options.map(o => o.options.map(o => o.role)).flat()
-    let memberRoles = interaction.member.roles.cache.map(r => r.id)
-    rolesToRemove = rolesToRemove.filter(r => memberRoles.includes(r)).filter(r => !rolesToAdd.includes(r))
-    rolesToAdd = rolesToAdd.filter(r => !memberRoles.includes(r))
+    let rolesToRemove = config.roleMenu.options.map(o => o.options.map(o => o.role)).flat();
+    const memberRoles = interaction.member.roles.cache.map(r => r.id);
+    rolesToRemove = rolesToRemove.filter(r => memberRoles.includes(r)).filter(r => !rolesToAdd.includes(r));
+    rolesToAdd = rolesToAdd.filter(r => !memberRoles.includes(r));
     try {
-        await interaction.member.roles.remove(rolesToRemove)
-        await interaction.member.roles.add(rolesToAdd)
+        await interaction.member.roles.remove(rolesToRemove);
+        await interaction.member.roles.add(rolesToAdd);
     } catch (e) {
         return await interaction.reply({embeds: [new EmojiEmbed()
             .setTitle("Roles")
             .setDescription("Something went wrong and your roles were not added. Please contact a staff member or try again later.")
             .setStatus("Danger")
             .setEmoji("GUILD.RED")
-        ], components: []})
+        ], components: []});
     }
     await interaction.editReply({embeds: [new EmojiEmbed()
         .setTitle("Roles")
         .setDescription("Roles have been added. You may close this message.")
         .setStatus("Success")
         .setEmoji("GUILD.GREEN")
-    ], components: []})
-    return
+    ], components: []});
+    return;
 }
diff --git a/src/actions/tickets/create.ts b/src/actions/tickets/create.ts
index 28eb435..6c8d42c 100644
--- a/src/actions/tickets/create.ts
+++ b/src/actions/tickets/create.ts
@@ -5,14 +5,14 @@
 import getEmojiByName from "../../utils/getEmojiByName.js";
 
 function capitalize(s: string) {
-    s = s.replace(/([A-Z])/g, ' $1');
+    s = s.replace(/([A-Z])/g, " $1");
     return s.length < 3 ? s.toUpperCase() : s[0].toUpperCase() + s.slice(1).toLowerCase();
 }
 
 export default async function (interaction) {
-    const { log, NucleusColors, entry, renderUser, renderChannel, renderDelta } = client.logger
+    const { log, NucleusColors, entry, renderUser, renderChannel, renderDelta } = client.logger;
 
-    let config = await client.database.guilds.read(interaction.guild.id);
+    const config = await client.database.guilds.read(interaction.guild.id);
     if (!config.tickets.enabled || !config.tickets.category) {
         return await interaction.reply({embeds: [new EmojiEmbed()
             .setTitle("Tickets are disabled")
@@ -22,7 +22,7 @@
             .setEmoji("CONTROL.BLOCKCROSS")
         ], ephemeral: true});
     }
-    let category = interaction.guild.channels.cache.get(config.tickets.category) as Discord.CategoryChannel;
+    const 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;
@@ -41,8 +41,8 @@
         ], ephemeral: true});
     }
     let ticketTypes;
-    let custom = false
-    if (config.tickets.customTypes && config.tickets.useCustom) { ticketTypes = config.tickets.customTypes; custom = true }
+    let custom = false;
+    if (config.tickets.customTypes && config.tickets.useCustom) { ticketTypes = config.tickets.customTypes; custom = true; }
     else if (config.tickets.types) ticketTypes = toHexArray(config.tickets.types, tickets);
     else ticketTypes = [];
     let chosenType;
@@ -54,7 +54,7 @@
                 return new MessageButton()
                     .setLabel(type)
                     .setStyle("PRIMARY")
-                    .setCustomId(type)
+                    .setCustomId(type);
             } else {
                 return new MessageButton()
                     .setLabel(capitalize(type))
@@ -66,7 +66,7 @@
         for (let i = 0; i < formattedTicketTypes.length; i += 5) {
             splitFormattedTicketTypes.push(new MessageActionRow().addComponents(formattedTicketTypes.slice(i, i + 5)));
         }
-        let m = await interaction.reply({embeds: [new EmojiEmbed()
+        const m = await interaction.reply({embeds: [new EmojiEmbed()
             .setTitle("Create Ticket")
             .setDescription("Select a ticket type")
             .setStatus("Success")
@@ -87,14 +87,14 @@
                     .setLabel(type)
                     .setStyle(chosenType === type ? "SUCCESS" : "SECONDARY")
                     .setCustomId(type)
-                    .setDisabled(true)
-                } else {
-                    return new MessageButton()
+                    .setDisabled(true);
+            } else {
+                return new MessageButton()
                     .setLabel(capitalize(type))
                     .setStyle(chosenType === type ? "SUCCESS" : "SECONDARY")
                     .setCustomId(type)
                     .setEmoji(getEmojiByName(("TICKETS." + type.toString().toUpperCase()), "id"))
-                    .setDisabled(true)
+                    .setDisabled(true);
             }
         });
         for (let i = 0; i < formattedTicketTypes.length; i += 5) {
@@ -107,13 +107,13 @@
             .setEmoji("GUILD.TICKET.OPEN")
         ], components: splitFormattedTicketTypes});
     } else {
-        chosenType = null
+        chosenType = null;
         await interaction.reply({embeds: [new EmojiEmbed()
             .setTitle("Create Ticket")
             .setEmoji("GUILD.TICKET.OPEN")
-        ], ephemeral: true, components: splitFormattedTicketTypes})
+        ], ephemeral: true, components: splitFormattedTicketTypes});
     }
-    let overwrites = [{
+    const overwrites = [{
         id: interaction.member,
         allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ATTACH_FILES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"],
         type: "member"
@@ -122,13 +122,13 @@
         id: interaction.guild.roles.everyone,
         deny: ["VIEW_CHANNEL"],
         type: "role"
-    })
+    });
     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"],
             type: "role"
-        })
+        });
     }
 
     let c;
@@ -140,7 +140,7 @@
             nsfw: false,
             permissionOverwrites: (overwrites as Discord.OverwriteResolvable[]),
             reason: "Creating ticket"
-        })
+        });
     } catch (e) {
         return await interaction.editReply({embeds: [new EmojiEmbed()
             .setTitle("Create Ticket")
@@ -158,17 +158,17 @@
                     roles: (config.tickets.supportRole !== null ? [config.tickets.supportRole] : [])
                 }
             }
-        )
+        );
         let content = interaction.options ? interaction.options.getString("message") || "" : "";
         if (content) content = `**Message:**\n> ${content}\n`;
-        let emoji = custom ? "" : getEmojiByName("TICKETS." + chosenType.toUpperCase());
+        const emoji = custom ? "" : getEmojiByName("TICKETS." + chosenType.toUpperCase());
         await c.send({ embeds: [new EmojiEmbed()
             .setTitle("New Ticket")
             .setDescription(
                 `Ticket created by <@${interaction.member.user.id}>\n` +
                 `**Support type:** ${chosenType !== null ? (emoji) + " " + capitalize(chosenType) : "General"}\n` +
                 `**Ticket ID:** \`${c.id}\`\n${content}\n` +
-                `Type \`/ticket close\` to close this ticket.`,
+                "Type `/ticket close` to close this ticket."
             )
             .setStatus("Success")
             .setEmoji("GUILD.TICKET.OPEN")
@@ -177,27 +177,27 @@
             .setStyle("DANGER")
             .setCustomId("closeticket")
             .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
-        ])]})
-        let data = {
+        ])]});
+        const data = {
             meta:{
-                type: 'ticketCreate',
-                displayName: 'Ticket Created',
+                type: "ticketCreate",
+                displayName: "Ticket Created",
                 calculateType: "ticketUpdate",
                 color: NucleusColors.green,
-                emoji: 'GUILD.TICKET.OPEN',
+                emoji: "GUILD.TICKET.OPEN",
                 timestamp: new Date().getTime()
             },
             list: {
                 ticketFor: entry(interaction.member.user.id, renderUser(interaction.member.user)),
                 created: entry(new Date().getTime(), renderDelta(new Date().getTime())),
-                ticketChannel: entry(c.id, renderChannel(c)),
+                ticketChannel: entry(c.id, renderChannel(c))
             },
             hidden: {
                 guild: interaction.guild.id
             }
-        }
+        };
         log(data);
-    } catch (e) { console.log(e)}
+    } catch (e) { console.log(e);}
     await interaction.editReply({embeds: [new EmojiEmbed()
         .setTitle("Create Ticket")
         .setDescription(`Ticket created. You can view it here: <#${c.id}>`)
diff --git a/src/actions/tickets/delete.ts b/src/actions/tickets/delete.ts
index d86396a..3419763 100644
--- a/src/actions/tickets/delete.ts
+++ b/src/actions/tickets/delete.ts
@@ -4,12 +4,12 @@
 import getEmojiByName from "../../utils/getEmojiByName.js";
 
 export default async function (interaction) {
-    const { log, NucleusColors, entry, renderUser, renderChannel, renderDelta } = client.logger
+    const { log, NucleusColors, entry, renderUser, renderChannel, renderDelta } = client.logger;
 
-    let config = await client.database.guilds.read(interaction.guild.id);
-    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)
+    const config = await client.database.guilds.read(interaction.guild.id);
+    let thread = false; let threadChannel;
+    if (interaction.channel instanceof Discord.ThreadChannel) thread = true; threadChannel = interaction.channel as Discord.ThreadChannel;
+    const channel = (interaction.channel as Discord.TextChannel);
     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...")
@@ -18,7 +18,7 @@
             .setEmoji("CONTROL.BLOCKCROSS")
         ], ephemeral: true});
     }
-    let status = channel.topic.split(" ")[1];
+    const status = channel.topic.split(" ")[1];
     if (status === "Archived") {
         await interaction.reply({embeds: [new EmojiEmbed()
             .setTitle("Delete Ticket")
@@ -26,13 +26,13 @@
             .setStatus("Danger")
             .setEmoji("GUILD.TICKET.CLOSE")
         ]});
-        let data = {
+        const data = {
             meta:{
-                type: 'ticketDeleted',
-                displayName: 'Ticket Deleted',
+                type: "ticketDeleted",
+                displayName: "Ticket Deleted",
                 calculateType: "ticketUpdate",
                 color: NucleusColors.red,
-                emoji: 'GUILD.TICKET.CLOSE',
+                emoji: "GUILD.TICKET.CLOSE",
                 timestamp: new Date().getTime()
             },
             list: {
@@ -43,7 +43,7 @@
             hidden: {
                 guild: interaction.guild.id
             }
-        }
+        };
         log(data);
         interaction.channel.delete();
         return;
@@ -54,7 +54,7 @@
             .setStatus("Warning")
             .setEmoji("GUILD.TICKET.ARCHIVED")
         ]});
-        let overwrites = [
+        const overwrites = [
             {
                 id: channel.topic.split(" ")[0],
                 deny: ["VIEW_CHANNEL"],
@@ -71,29 +71,29 @@
                 id: interaction.guild.roles.cache.get(config.tickets.supportRole),
                 allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ATTACH_FILES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"],
                 type: "role"
-            })
+            });
         }
-        channel.edit({permissionOverwrites: overwrites})
+        channel.edit({permissionOverwrites: overwrites});
         channel.setTopic(`${channel.topic.split(" ")[0]} Archived`);
-        let data = {
+        const data = {
             meta:{
-                type: 'ticketClosed',
-                displayName: 'Ticket Closed',
+                type: "ticketClosed",
+                displayName: "Ticket Closed",
                 calculateType: "ticketUpdate",
                 color: NucleusColors.yellow,
-                emoji: 'GUILD.TICKET.ARCHIVED',
+                emoji: "GUILD.TICKET.ARCHIVED",
                 timestamp: new Date().getTime()
             },
             list: {
                 ticketFor: entry(channel.topic.split(" ")[0], renderUser((await interaction.guild.members.fetch(channel.topic.split(" ")[0])).user)),
                 closedBy: entry(interaction.member.user.id, renderUser(interaction.member.user)),
                 closed: entry(new Date().getTime(), renderDelta(new Date().getTime())),
-                ticketChannel: entry(channel.id, renderChannel(channel)),
+                ticketChannel: entry(channel.id, renderChannel(channel))
             },
             hidden: {
                 guild: interaction.guild.id
             }
-        }
+        };
         log(data);
         await interaction.editReply({embeds: [new EmojiEmbed()
             .setTitle("Close Ticket")
@@ -107,8 +107,8 @@
                     .setStyle("DANGER")
                     .setCustomId("closeticket")
                     .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
-                ].concat(client.database.premium.hasPremium(interaction.guild.id) ? [
-                    new MessageButton()
+            ].concat(client.database.premium.hasPremium(interaction.guild.id) ? [
+                new MessageButton()
                     .setLabel("Create Transcript and Delete")
                     .setStyle("PRIMARY")
                     .setCustomId("createtranscript")
@@ -120,42 +120,44 @@
 }
 
 async function purgeByUser(member, guild) {
-    let config = await client.database.guilds.read(guild.id);
+    const config = await client.database.guilds.read(guild.id);
     if (!config.tickets.category) return;
-    let tickets = guild.channels.cache.get(config.tickets.category);
+    const tickets = guild.channels.cache.get(config.tickets.category);
     if (!tickets) return;
-    let ticketChannels = tickets.children;
-    let deleted = 0
+    const ticketChannels = tickets.children;
+    let deleted = 0;
     ticketChannels.forEach(element => {
         if (element.type !== "GUILD_TEXT") return;
         if (element.topic.split(" ")[0] === member) {
-            try { element.delete(); } catch {}
-            deleted++
+            try {
+                element.delete();
+            } catch { /* Errors if the channel does not exist (deleted already) */ }
+            deleted++;
         }
     });
     if (deleted) {
-        const { log, NucleusColors, entry, renderUser, renderDelta } = member.client.logger
-        let data = {
+        const { log, NucleusColors, entry, renderUser, renderDelta } = member.client.logger;
+        const data = {
             meta:{
-                type: 'ticketPurge',
-                displayName: 'Tickets Purged',
+                type: "ticketPurge",
+                displayName: "Tickets Purged",
                 calculateType: "ticketUpdate",
                 color: NucleusColors.red,
-                emoji: 'GUILD.TICKET.DELETE',
+                emoji: "GUILD.TICKET.DELETE",
                 timestamp: new Date().getTime()
             },
             list: {
                 ticketFor: entry(member, renderUser(member)),
                 deletedBy: entry(null, "Member left server"),
                 deleted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
-                ticketsDeleted: deleted,
+                ticketsDeleted: deleted
             },
             hidden: {
                 guild: guild.id
             }
-        }
+        };
         log(data);
     }
 }
 
-export { purgeByUser }
\ No newline at end of file
+export { purgeByUser };
\ No newline at end of file
