diff --git a/src/events/channelCreate.ts b/src/events/channelCreate.ts
index f7ec756..883efd9 100644
--- a/src/events/channelCreate.ts
+++ b/src/events/channelCreate.ts
@@ -3,69 +3,71 @@
 export const event = 'channelCreate'
 
 export async function callback(client, channel) {
-	const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = channel.client.logger
-    let auditLog = await getAuditLog(channel.guild, 'CHANNEL_CREATE');
-    let audit = auditLog.entries.filter(entry => entry.target.id == channel.id).first();
-    if (audit.executor.id == client.user.id) return;
-    let emoji;
-    let readableType;
-    let displayName;
-    switch (channel.type) {
-        case 'GUILD_TEXT': {
-            emoji = "CHANNEL.TEXT.CREATE";
-            readableType = "Text";
-            displayName = "Text Channel"
-            break;
+    try {
+        const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = channel.client.logger
+        let auditLog = await getAuditLog(channel.guild, 'CHANNEL_CREATE');
+        let audit = auditLog.entries.filter(entry => entry.target.id == channel.id).first();
+        if (audit.executor.id == client.user.id) return;
+        let emoji;
+        let readableType;
+        let displayName;
+        switch (channel.type) {
+            case 'GUILD_TEXT': {
+                emoji = "CHANNEL.TEXT.CREATE";
+                readableType = "Text";
+                displayName = "Text Channel"
+                break;
+            }
+            case 'GUILD_NEWS': {
+                emoji = "CHANNEL.TEXT.CREATE";
+                readableType = "Announcement";
+                displayName = "Announcement Channel"
+                break;
+            }
+            case 'GUILD_VOICE': {
+                emoji = "CHANNEL.VOICE.CREATE";
+                readableType = "Voice";
+                displayName = "Voice Channel"
+                break;
+            }
+            case 'GUILD_STAGE': {
+                emoji = "CHANNEL.VOICE.CREATE";
+                readableType = "Stage";
+                displayName = "Stage Channel"
+            }
+            case 'GUILD_CATEGORY': {
+                emoji = "CHANNEL.CATEGORY.CREATE";
+                readableType = "Category";
+                displayName = "Category"
+                break;
+            }
+            default: {
+                emoji = "CHANNEL.TEXT.CREATE";
+                readableType = "Channel";
+                displayName = "Channel"
+            }
         }
-        case 'GUILD_NEWS': {
-            emoji = "CHANNEL.TEXT.CREATE";
-            readableType = "Announcement";
-            displayName = "Announcement Channel"
-            break;
+        let data = {
+            meta: {
+                type: 'channelCreate',
+                displayName: displayName + ' Created',
+                calculateType: 'channelUpdate',
+                color: NucleusColors.green,
+                emoji: emoji,
+                timestamp: channel.createdTimestamp
+            },
+            list: {
+                id: entry(channel.id, `\`${channel.id}\``),
+                name: entry(channel.name, renderChannel(channel)),
+                type: entry(channel.type, readableType),
+                category: entry(channel.parent ? channel.parent.id : null, channel.parent ? channel.parent.name : "Uncategorised"),
+                createdBy: entry(audit.executor.id, renderUser(audit.executor)),
+                created: entry(channel.createdTimestamp, renderDelta(channel.createdTimestamp))
+            },
+            hidden: {
+                guild: channel.guild.id
+            }
         }
-        case 'GUILD_VOICE': {
-            emoji = "CHANNEL.VOICE.CREATE";
-            readableType = "Voice";
-            displayName = "Voice Channel"
-            break;
-        }
-        case 'GUILD_STAGE': {
-            emoji = "CHANNEL.VOICE.CREATE";
-            readableType = "Stage";
-            displayName = "Stage Channel"
-        }
-        case 'GUILD_CATEGORY': {
-            emoji = "CHANNEL.CATEGORY.CREATE";
-            readableType = "Category";
-            displayName = "Category"
-            break;
-        }
-        default: {
-            emoji = "CHANNEL.TEXT.CREATE";
-            readableType = "Channel";
-            displayName = "Channel"
-        }
-    }
-    let data = {
-        meta: {
-            type: 'channelCreate',
-            displayName: displayName + ' Created',
-            calculateType: 'channelUpdate',
-            color: NucleusColors.green,
-            emoji: emoji,
-            timestamp: channel.createdTimestamp
-        },
-        list: {
-            id: entry(channel.id, `\`${channel.id}\``),
-            name: entry(channel.name, renderChannel(channel)),
-            type: entry(channel.type, readableType),
-            category: entry(channel.parent ? channel.parent.id : null, channel.parent ? channel.parent.name : "Uncategorised"),
-            createdBy: entry(audit.executor.id, renderUser(audit.executor)),
-            created: entry(channel.createdTimestamp, renderDelta(channel.createdTimestamp))
-        },
-        hidden: {
-            guild: channel.guild.id
-        }
-    }
-    log(data, channel.client);
+        log(data, channel.client);
+    } catch {}
 }
diff --git a/src/events/channelDelete.ts b/src/events/channelDelete.ts
index ac29238..e8c888a 100644
--- a/src/events/channelDelete.ts
+++ b/src/events/channelDelete.ts
@@ -3,69 +3,71 @@
 export const event = 'channelDelete'
 
 export async function callback(client, channel) {
-	const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser } = channel.client.logger
+    try{
+        const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser } = channel.client.logger
 
-	let auditLog = await getAuditLog(channel.guild, 'CHANNEL_DELETE');
-	let audit = auditLog.entries.filter(entry => entry.target.id == channel.id).first();
-    if (audit.executor.id == client.user.id) return;
+        let auditLog = await getAuditLog(channel.guild, 'CHANNEL_DELETE');
+        let audit = auditLog.entries.filter(entry => entry.target.id == channel.id).first();
+        if (audit.executor.id == client.user.id) return;
 
-	let emoji;
-	let readableType;
-	let displayName;
-	switch (channel.type) {
-		case 'GUILD_TEXT': {
-			emoji = "CHANNEL.TEXT.DELETE";
-			readableType = "Text";
-			displayName = "Text Channel"
-			break;
-		}
-		case 'GUILD_VOICE': {
-			emoji = "CHANNEL.VOICE.DELETE";
-			readableType = "Voice";
-			displayName = "Voice Channel"
-			break;
-		}
-		case 'GUILD_CATEGORY': {
-			emoji = "CHANNEL.CATEGORY.DELETE";
-			readableType = "Category";
-			displayName = "Category"
-			break;
-		}
-		default: {
-			emoji = "CHANNEL.TEXT.DELETE";
-			readableType = "Channel";
-			displayName = "Channel"
-		}
-	}
-	let list = {
-		id: entry(channel.id, `\`${channel.id}\``),
-		name: entry(channel.id, `${channel.name}`),
-		topic: null,
-		type: entry(channel.type, readableType),
-		category: entry(channel.parent ? channel.parent.id : null, channel.parent ? channel.parent.name : "Uncategorised"),
-		nsfw: null,
-		created: entry(channel.createdTimestamp, renderDelta(channel.createdTimestamp)),
-		deleted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
-		deletedBy: entry(audit.executor.id, renderUser(audit.executor))
-	}
-	if (channel.topic != null ?? false) list.topic = entry(channel.topic, `\`\`\`\n${channel.topic.replace('`', "'")}\n\`\`\``);
-	else delete list.topic;
-	if (channel.nsfw !== null ?? false) list.nsfw = entry(channel.nsfw, channel.nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`);
-	else delete list.nsfw;
+        let emoji;
+        let readableType;
+        let displayName;
+        switch (channel.type) {
+            case 'GUILD_TEXT': {
+                emoji = "CHANNEL.TEXT.DELETE";
+                readableType = "Text";
+                displayName = "Text Channel"
+                break;
+            }
+            case 'GUILD_VOICE': {
+                emoji = "CHANNEL.VOICE.DELETE";
+                readableType = "Voice";
+                displayName = "Voice Channel"
+                break;
+            }
+            case 'GUILD_CATEGORY': {
+                emoji = "CHANNEL.CATEGORY.DELETE";
+                readableType = "Category";
+                displayName = "Category"
+                break;
+            }
+            default: {
+                emoji = "CHANNEL.TEXT.DELETE";
+                readableType = "Channel";
+                displayName = "Channel"
+            }
+        }
+        let list = {
+            id: entry(channel.id, `\`${channel.id}\``),
+            name: entry(channel.id, `${channel.name}`),
+            topic: null,
+            type: entry(channel.type, readableType),
+            category: entry(channel.parent ? channel.parent.id : null, channel.parent ? channel.parent.name : "Uncategorised"),
+            nsfw: null,
+            created: entry(channel.createdTimestamp, renderDelta(channel.createdTimestamp)),
+            deleted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+            deletedBy: entry(audit.executor.id, renderUser(audit.executor))
+        }
+        if (channel.topic != null ?? false) list.topic = entry(channel.topic, `\`\`\`\n${channel.topic.replace('`', "'")}\n\`\`\``);
+        else delete list.topic;
+        if (channel.nsfw !== null ?? false) list.nsfw = entry(channel.nsfw, channel.nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`);
+        else delete list.nsfw;
 
-	let data = {
-		meta:{
-			type: 'channelDelete',
-			displayName: displayName + ' Deleted',
-			calculateType: 'channelUpdate',
-			color: NucleusColors.red,
-			emoji: emoji,
-			timestamp: audit.createdTimestamp
-		},
-		list: list,
-		hidden: {
-			guild: channel.guild.id
-		}
-	}
-	log(data, channel.client);
+        let data = {
+            meta:{
+                type: 'channelDelete',
+                displayName: displayName + ' Deleted',
+                calculateType: 'channelUpdate',
+                color: NucleusColors.red,
+                emoji: emoji,
+                timestamp: audit.createdTimestamp
+            },
+            list: list,
+            hidden: {
+                guild: channel.guild.id
+            }
+        }
+        log(data, channel.client);
+    } catch {}
 }
diff --git a/src/events/channelUpdate.ts b/src/events/channelUpdate.ts
index f374edd..25b7375 100644
--- a/src/events/channelUpdate.ts
+++ b/src/events/channelUpdate.ts
@@ -1,133 +1,135 @@
 import humanizeDuration from 'humanize-duration';
-import readConfig from '../utils/readConfig.js'
 import getEmojiByName from '../utils/getEmojiByName.js';
 
 export const event = 'channelUpdate';
 
 export async function callback(client, oc, nc) {
-	let config = await readConfig(nc.guild.id);
-	const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser, renderChannel } = client.logger
+    try {
+        let config = await client.memory.readGuildInfo(nc.guild.id);
+        const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser, renderChannel } = client.logger
 
-	if (nc.parent && (nc.parent.id == config.tickets.category)) return
+        if (nc.parent && (nc.parent.id == config.tickets.category)) return
 
-	let auditLog = await getAuditLog(nc.guild, 'CHANNEL_UPDATE');
-	let audit = auditLog.entries.filter(entry => entry.target.id == nc.id).first();
-    if (audit.executor.id == client.user.id) return;
+        let auditLog = await getAuditLog(nc.guild, 'CHANNEL_UPDATE');
+        let audit = auditLog.entries.filter(entry => entry.target.id == nc.id).first();
+        if (audit.executor.id == client.user.id) return;
 
-	let emoji:string;
-	let readableType:string;
-	let displayName:string ;
-	let changes = {
-		id: entry(nc.id, `\`${nc.id}\``),
-		channel: entry(nc.id, renderChannel(nc)),
-		edited: entry(new Date().getTime(), renderDelta(new Date().getTime())),
-		editedBy: entry(audit.executor.id, renderUser((await nc.guild.members.fetch(audit.executor.id)).user)),
-	}
-	if (oc.name != nc.name) changes["name"] = entry([oc.name, nc.name], `${oc.name} -> ${nc.name}`);
-	if (oc.position != nc.position) changes["position"] = entry([oc.position, nc.position], `${oc.position} -> ${nc.position}`);
+        let emoji:string;
+        let readableType:string;
+        let displayName:string ;
+        let changes = {
+            id: entry(nc.id, `\`${nc.id}\``),
+            channel: entry(nc.id, renderChannel(nc)),
+            edited: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+            editedBy: entry(audit.executor.id, renderUser((await nc.guild.members.fetch(audit.executor.id)).user)),
+        }
+        if (oc.name != nc.name) changes["name"] = entry([oc.name, nc.name], `${oc.name} -> ${nc.name}`);
+        if (oc.position != nc.position) changes["position"] = entry([oc.position, nc.position], `${oc.position} -> ${nc.position}`);
 
-	switch (nc.type) {
-		case 'GUILD_TEXT': {
-			emoji = "CHANNEL.TEXT.EDIT";
-			readableType = "Text";
-			displayName = "Text Channel"
-			let oldTopic = oc.topic, newTopic = nc.topic;
-			if (oldTopic) {
-				if (oldTopic.length > 256) oldTopic = `\`\`\`\n${oldTopic.replace('`', "'").substring(0, 253) + '...'}\n\`\`\``
-				else oldTopic = `\`\`\`\n${oldTopic.replace('`', "'")}\n\`\`\``
-			} else { oldTopic = "None"; }
-			if (newTopic) {
-				if (newTopic.length > 256) newTopic = `\`\`\`\n${newTopic.replace('`', "'").substring(0, 253) + '...'}\n\`\`\``
-				else newTopic = `\`\`\`\n${newTopic.replace('`', "'")}\n\`\`\``
-			} else { newTopic = "None"; }
-			let nsfw = ["", ""]
-			nsfw[0] = oc.nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
-			nsfw[1] = nc.nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
-			if (oc.topic != nc.topic) changes["description"] = entry([oc.topic, nc.topic], `\nBefore: ${oldTopic}\nAfter: ${newTopic}`);
-			if (oc.nsfw != nc.nsfw) changes["nsfw"] = entry([oc.nsfw, nc.nsfw], `${nsfw[0]} -> ${nsfw[1]}`);
-			if (oc.rateLimitPerUser != nc.rateLimitPerUser) changes["rateLimitPerUser"] = entry(
-				[oc.rateLimitPerUser, nc.rateLimitPerUser],
-				`${humanizeDuration(oc.rateLimitPerUser * 1000)} -> ${humanizeDuration(nc.rateLimitPerUser * 1000)}`
-			);
-			break;
-		}
-		case 'GUILD_NEWS': {
-			emoji = "CHANNEL.TEXT.EDIT";
-			readableType = "News";
-			displayName = "News Channel"
-			let oldTopic = oc.topic, newTopic = nc.topic;
-			if (oldTopic) {
-				if (oldTopic.length > 256) oldTopic = `\`\`\`\n${oldTopic.replace('`', "'").substring(0, 253) + '...'}\n\`\`\``
-				else oldTopic = `\`\`\`\n${oldTopic.replace('`', "'")}\n\`\`\``
-			} else { oldTopic = "None"; }
-			if (newTopic) {
-				if (newTopic.length > 256) newTopic = `\`\`\`\n${newTopic.replace('`', "'").substring(0, 253) + '...'}\n\`\`\``
-				else newTopic = `\`\`\`\n${newTopic.replace('`', "'")}\n\`\`\``
-			} else { newTopic = "None"; }
-			if (oc.nsfw != nc.nsfw) changes["nsfw"] = entry([oc.nsfw, nc.nsfw], `${oc.nsfw ? "On" : "Off"} -> ${nc.nsfw ? "On" : "Off"}`);
-			break;
-		}
-		case 'GUILD_VOICE': {
-			emoji = "CHANNEL.VOICE.EDIT";
-			readableType = "Voice";
-			displayName = "Voice Channel"
-			if (oc.bitrate != nc.bitrate) changes["bitrate"] = entry([oc.bitrate, nc.bitrate], `${oc.bitrate} -> ${nc.bitrate}`);
-			if (oc.userLimit != nc.userLimit) changes["maxUsers"] = entry([oc.userLimit, nc.userLimit], `${oc.userLimit ? oc.userLimit : "Unlimited"} -> ${nc.userLimit}`);
-			if (oc.rtcRegion != nc.rtcRegion) changes["region"] = entry(
-				[oc.rtcRegion, nc.rtcRegion],
-				`${oc.rtcRegion || "Automatic"} -> ${nc.rtcRegion || "Automatic"}`
-			);
-			break;
-		}
-		case 'GUILD_STAGE': {
-			emoji = "CHANNEL.VOICE.EDIT";
-			readableType = "Stage";
-			displayName = "Stage Channel"
-			let oldTopic = oc.topic, newTopic = nc.topic;
-			if (oldTopic) {
-				if (oldTopic.length > 256) oldTopic = `\`\`\`\n${oldTopic.replace('`', "'").substring(0, 253) + '...'}\n\`\`\``
-				else oldTopic = `\`\`\`\n${oldTopic.replace('`', "'")}\n\`\`\``
-			} else { oldTopic = "None"; }
-			if (newTopic) {
-				if (newTopic.length > 256) newTopic = `\`\`\`\n${newTopic.replace('`', "'").substring(0, 253) + '...'}\n\`\`\``
-				else newTopic = `\`\`\`\n${newTopic.replace('`', "'")}\n\`\`\``
-			} else { newTopic = "None"; }
-			if (oc.bitrate != nc.bitrate) changes["bitrate"] = entry([oc.bitrate, nc.bitrate], `${oc.bitrate} -> ${nc.bitrate}`);
-			if (oc.userLimit != nc.userLimit) changes["maxUsers"] = entry([oc.userLimit, nc.userLimit], `${oc.userLimit ? oc.userLimit : "Unlimited"} -> ${nc.userLimit}`);
-			if (oc.rtcRegion != nc.rtcRegion) changes["region"] = entry(
-				[oc.rtcRegion, nc.rtcRegion],
-				`${oc.rtcRegion || "Automatic"} -> ${nc.rtcRegion || "Automatic"}`
-			);
-			break;
-		}
-		case 'GUILD_CATEGORY': {
-			emoji = "CHANNEL.CATEGORY.EDIT";
-			readableType = "Category";
-			displayName = "Category"
-			break;
-		}
-		default: {
-			emoji = "CHANNEL.TEXT.EDIT";
-			readableType = "Channel";
-			displayName = "Channel"
-		}
-	}
-	let t = oc.type.split("_")[1];
-	if (oc.type != nc.type) changes["type"] = entry([oc.type, nc.type], `${t[0] + t.splice(1).toLowerCase()} -> ${readableType}`);
-	if (!(Object.values(changes).length - 4)) return
-	let data = {
-		meta:{
-			type: 'channelUpdate',
-			displayName: displayName + ' Edited',
-			calculateType: 'channelUpdate',
-			color: NucleusColors.yellow,
-			emoji: emoji,
-			timestamp: audit.createdTimestamp
-		},
-		list: changes,
-		hidden: {
-			guild: nc.guild.id
-		}
-	}
-	log(data, client);
+        switch (nc.type) {
+            case 'GUILD_TEXT': {
+                emoji = "CHANNEL.TEXT.EDIT";
+                readableType = "Text";
+                displayName = "Text Channel"
+                let oldTopic = oc.topic, newTopic = nc.topic;
+                if (oldTopic) {
+                    if (oldTopic.length > 256) oldTopic = `\`\`\`\n${oldTopic.replace('`', "'").substring(0, 253) + '...'}\n\`\`\``
+                    else oldTopic = `\`\`\`\n${oldTopic.replace('`', "'")}\n\`\`\``
+                } else { oldTopic = "None"; }
+                if (newTopic) {
+                    if (newTopic.length > 256) newTopic = `\`\`\`\n${newTopic.replace('`', "'").substring(0, 253) + '...'}\n\`\`\``
+                    else newTopic = `\`\`\`\n${newTopic.replace('`', "'")}\n\`\`\``
+                } else { newTopic = "None"; }
+                let nsfw = ["", ""]
+                nsfw[0] = oc.nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
+                nsfw[1] = nc.nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
+                if (oc.topic != nc.topic) changes["description"] = entry([oc.topic, nc.topic], `\nBefore: ${oldTopic}\nAfter: ${newTopic}`);
+                if (oc.nsfw != nc.nsfw) changes["nsfw"] = entry([oc.nsfw, nc.nsfw], `${nsfw[0]} -> ${nsfw[1]}`);
+                if (oc.rateLimitPerUser != nc.rateLimitPerUser) changes["rateLimitPerUser"] = entry(
+                    [oc.rateLimitPerUser, nc.rateLimitPerUser],
+                    `${humanizeDuration(oc.rateLimitPerUser * 1000)} -> ${humanizeDuration(nc.rateLimitPerUser * 1000)}`
+                );
+
+                break;
+            }
+            case 'GUILD_NEWS': {
+                emoji = "CHANNEL.TEXT.EDIT";
+                readableType = "News";
+                displayName = "News Channel"
+                let oldTopic = oc.topic, newTopic = nc.topic;
+                if (oldTopic) {
+                    if (oldTopic.length > 256) oldTopic = `\`\`\`\n${oldTopic.replace('`', "'").substring(0, 253) + '...'}\n\`\`\``
+                    else oldTopic = `\`\`\`\n${oldTopic.replace('`', "'")}\n\`\`\``
+                } else { oldTopic = "None"; }
+                if (newTopic) {
+                    if (newTopic.length > 256) newTopic = `\`\`\`\n${newTopic.replace('`', "'").substring(0, 253) + '...'}\n\`\`\``
+                    else newTopic = `\`\`\`\n${newTopic.replace('`', "'")}\n\`\`\``
+                } else { newTopic = "None"; }
+                if (oc.nsfw != nc.nsfw) changes["nsfw"] = entry([oc.nsfw, nc.nsfw], `${oc.nsfw ? "On" : "Off"} -> ${nc.nsfw ? "On" : "Off"}`);
+                break;
+            }
+            case 'GUILD_VOICE': {
+                emoji = "CHANNEL.VOICE.EDIT";
+                readableType = "Voice";
+                displayName = "Voice Channel"
+                if (oc.bitrate != nc.bitrate) changes["bitrate"] = entry([oc.bitrate, nc.bitrate], `${oc.bitrate} -> ${nc.bitrate}`);
+                if (oc.userLimit != nc.userLimit) changes["maxUsers"] = entry([oc.userLimit, nc.userLimit], `${oc.userLimit ? oc.userLimit : "Unlimited"} -> ${nc.userLimit}`);
+                if (oc.rtcRegion != nc.rtcRegion) changes["region"] = entry(
+                    [oc.rtcRegion, nc.rtcRegion],
+                    `${oc.rtcRegion || "Automatic"} -> ${nc.rtcRegion || "Automatic"}`
+                );
+                break;
+            }
+            case 'GUILD_STAGE': {
+                emoji = "CHANNEL.VOICE.EDIT";
+                readableType = "Stage";
+                displayName = "Stage Channel"
+                let oldTopic = oc.topic, newTopic = nc.topic;
+                if (oldTopic) {
+                    if (oldTopic.length > 256) oldTopic = `\`\`\`\n${oldTopic.replace('`', "'").substring(0, 253) + '...'}\n\`\`\``
+                    else oldTopic = `\`\`\`\n${oldTopic.replace('`', "'")}\n\`\`\``
+                } else { oldTopic = "None"; }
+                if (newTopic) {
+                    if (newTopic.length > 256) newTopic = `\`\`\`\n${newTopic.replace('`', "'").substring(0, 253) + '...'}\n\`\`\``
+                    else newTopic = `\`\`\`\n${newTopic.replace('`', "'")}\n\`\`\``
+                } else { newTopic = "None"; }
+                if (oc.bitrate != nc.bitrate) changes["bitrate"] = entry([oc.bitrate, nc.bitrate], `${oc.bitrate} -> ${nc.bitrate}`);
+                if (oc.userLimit != nc.userLimit) changes["maxUsers"] = entry([oc.userLimit, nc.userLimit], `${oc.userLimit ? oc.userLimit : "Unlimited"} -> ${nc.userLimit}`);
+                if (oc.rtcRegion != nc.rtcRegion) changes["region"] = entry(
+                    [oc.rtcRegion, nc.rtcRegion],
+                    `${oc.rtcRegion || "Automatic"} -> ${nc.rtcRegion || "Automatic"}`
+                );
+                break;
+            }
+            case 'GUILD_CATEGORY': {
+                emoji = "CHANNEL.CATEGORY.EDIT";
+                readableType = "Category";
+                displayName = "Category"
+                break;
+            }
+            default: {
+                emoji = "CHANNEL.TEXT.EDIT";
+                readableType = "Channel";
+                displayName = "Channel"
+            }
+        }
+        let t = oc.type.split("_")[1];
+        if (oc.type != nc.type) changes["type"] = entry([oc.type, nc.type], `${t[0] + t.splice(1).toLowerCase()} -> ${readableType}`);
+        if (!(Object.values(changes).length - 4)) return
+        let data = {
+            meta:{
+                type: 'channelUpdate',
+                displayName: displayName + ' Edited',
+                calculateType: 'channelUpdate',
+                color: NucleusColors.yellow,
+                emoji: emoji,
+                timestamp: audit.createdTimestamp
+            },
+            list: changes,
+            hidden: {
+                guild: nc.guild.id
+            }
+        }
+        log(data, client);
+    } catch {}
 }
\ No newline at end of file
diff --git a/src/events/emojiCreate.ts b/src/events/emojiCreate.ts
index 3320267..c1ed3c5 100644
--- a/src/events/emojiCreate.ts
+++ b/src/events/emojiCreate.ts
@@ -1,28 +1,30 @@
 export const event = 'emojiCreate'
 
 export async function callback(client, emoji) {
-	const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderEmoji } = emoji.client.logger
-    let auditLog = await getAuditLog(emoji.guild, 'EMOJI_CREATE');
-    let audit = auditLog.entries.filter(entry => entry.target.id == emoji.id).first();
-    if (audit.executor.id == client.user.id) return;
-    let data = {
-        meta: {
-            type: 'emojiCreate',
-            displayName: 'Emoji Created',
-            calculateType: 'emojiUpdate',
-            color: NucleusColors.green,
-            emoji: "GUILD.EMOJI.CREATE",
-            timestamp: emoji.createdTimestamp
-        },
-        list: {
-            id: entry(emoji.id, `\`${emoji.id}\``),
-            emoji: entry(emoji.name, renderEmoji(emoji)),
-            createdBy: entry(audit.executor.id, renderUser(audit.executor)),
-            created: entry(emoji.createdTimestamp, renderDelta(emoji.createdTimestamp))
-        },
-        hidden: {
-            guild: emoji.guild.id
+    try {
+        const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderEmoji } = emoji.client.logger
+        let auditLog = await getAuditLog(emoji.guild, 'EMOJI_CREATE');
+        let audit = auditLog.entries.filter(entry => entry.target.id == emoji.id).first();
+        if (audit.executor.id == client.user.id) return;
+        let data = {
+            meta: {
+                type: 'emojiCreate',
+                displayName: 'Emoji Created',
+                calculateType: 'emojiUpdate',
+                color: NucleusColors.green,
+                emoji: "GUILD.EMOJI.CREATE",
+                timestamp: emoji.createdTimestamp
+            },
+            list: {
+                id: entry(emoji.id, `\`${emoji.id}\``),
+                emoji: entry(emoji.name, renderEmoji(emoji)),
+                createdBy: entry(audit.executor.id, renderUser(audit.executor)),
+                created: entry(emoji.createdTimestamp, renderDelta(emoji.createdTimestamp))
+            },
+            hidden: {
+                guild: emoji.guild.id
+            }
         }
-    }
-    log(data, client);
+        log(data, client);
+    } catch {}
 }
diff --git a/src/events/emojiDelete.ts b/src/events/emojiDelete.ts
index d31b9c6..59bed1e 100644
--- a/src/events/emojiDelete.ts
+++ b/src/events/emojiDelete.ts
@@ -1,29 +1,31 @@
 export const event = 'emojiDelete'
 
 export async function callback(client, emoji) {
-	const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderEmoji } = emoji.client.logger
-    let auditLog = await getAuditLog(emoji.guild, 'EMOJI_DELETE');
-    let audit = auditLog.entries.filter(entry => entry.target.id == emoji.id).first();
-    if (audit.executor.id == client.user.id) return;
-    let data = {
-        meta: {
-            type: 'emojiDelete',
-            displayName: 'Emoji Deleted',
-            calculateType: 'emojiUpdate',
-            color: NucleusColors.red,
-            emoji: "GUILD.EMOJI.DELETE",
-            timestamp: audit.createdTimestamp,
-        },
-        list: {
-            id: entry(emoji.id, `\`${emoji.id}\``),
-            emoji: entry(emoji.name, renderEmoji(emoji)),
-            deletedBy: entry(audit.executor.id, renderUser(audit.executor)),
-            created: entry(emoji.createdTimestamp, renderDelta(emoji.createdTimestamp)),
-			deleted: entry(audit.createdTimestamp, renderDelta(audit.createdTimestamp)),
-        },
-        hidden: {
-            guild: emoji.guild.id
+    try{
+        const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderEmoji } = emoji.client.logger
+        let auditLog = await getAuditLog(emoji.guild, 'EMOJI_DELETE');
+        let audit = auditLog.entries.filter(entry => entry.target.id == emoji.id).first();
+        if (audit.executor.id == client.user.id) return;
+        let data = {
+            meta: {
+                type: 'emojiDelete',
+                displayName: 'Emoji Deleted',
+                calculateType: 'emojiUpdate',
+                color: NucleusColors.red,
+                emoji: "GUILD.EMOJI.DELETE",
+                timestamp: audit.createdTimestamp,
+            },
+            list: {
+                id: entry(emoji.id, `\`${emoji.id}\``),
+                emoji: entry(emoji.name, renderEmoji(emoji)),
+                deletedBy: entry(audit.executor.id, renderUser(audit.executor)),
+                created: entry(emoji.createdTimestamp, renderDelta(emoji.createdTimestamp)),
+                deleted: entry(audit.createdTimestamp, renderDelta(audit.createdTimestamp)),
+            },
+            hidden: {
+                guild: emoji.guild.id
+            }
         }
-    }
-    log(data, client);
+        log(data, client);
+    } catch {}
 }
diff --git a/src/events/emojiUpdate.ts b/src/events/emojiUpdate.ts
index 2566fed..2171b18 100644
--- a/src/events/emojiUpdate.ts
+++ b/src/events/emojiUpdate.ts
@@ -3,33 +3,35 @@
 export const event = 'emojiUpdate';
 
 export async function callback(client, oe, ne) {
-	const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser, renderEmoji } = client.logger
+    try {
+        const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser, renderEmoji } = client.logger
 
-    if (oe.name == ne.name) return
-	let auditLog = await getAuditLog(ne.guild, 'EMOJI_UPDATE');
-	let audit = auditLog.entries.first();
-    if (audit.executor.id == client.user.id) return;
+        if (oe.name == ne.name) return
+        let auditLog = await getAuditLog(ne.guild, 'EMOJI_UPDATE');
+        let audit = auditLog.entries.first();
+        if (audit.executor.id == client.user.id) return;
 
-	let changes = {
-		id: entry(ne.id, `\`${ne.id}\``),
-		emoji: entry(ne.id, renderEmoji(ne)),
-		edited: entry(ne.createdTimestamp, renderDelta(ne.createdTimestamp)),
-		editedBy: entry(audit.executor.id, renderUser((await ne.guild.members.fetch(audit.executor.id)).user)),
-		name: entry([oe.name, ne.name], `\`:${oe.name}:\` -> \`:${ne.name}:\``),
-	}
-	let data = {
-		meta:{
-			type: 'emojiUpdate',
-			displayName: 'Emoji Edited',
-			calculateType: 'emojiUpdate',
-			color: NucleusColors.yellow,
-			emoji: "GUILD.EMOJI.EDIT",
-			timestamp: audit.createdTimestamp
-		},
-		list: changes,
-		hidden: {
-			guild: ne.guild.id
-		}
-	}
-	log(data, client);
+        let changes = {
+            id: entry(ne.id, `\`${ne.id}\``),
+            emoji: entry(ne.id, renderEmoji(ne)),
+            edited: entry(ne.createdTimestamp, renderDelta(ne.createdTimestamp)),
+            editedBy: entry(audit.executor.id, renderUser((await ne.guild.members.fetch(audit.executor.id)).user)),
+            name: entry([oe.name, ne.name], `\`:${oe.name}:\` -> \`:${ne.name}:\``),
+        }
+        let data = {
+            meta:{
+                type: 'emojiUpdate',
+                displayName: 'Emoji Edited',
+                calculateType: 'emojiUpdate',
+                color: NucleusColors.yellow,
+                emoji: "GUILD.EMOJI.EDIT",
+                timestamp: audit.createdTimestamp
+            },
+            list: changes,
+            hidden: {
+                guild: ne.guild.id
+            }
+        }
+        log(data, client);
+    } catch {}
 }
\ No newline at end of file
diff --git a/src/events/guildBanAdd.ts b/src/events/guildBanAdd.ts
new file mode 100644
index 0000000..4209788
--- /dev/null
+++ b/src/events/guildBanAdd.ts
@@ -0,0 +1,39 @@
+import { purgeByUser } from '../automations/tickets/delete.js';
+import { callback as statsChannelRemove } from '../automations/statsChannelRemove.js';
+
+export const event = 'guildBanAdd';
+
+export async function callback(client, ban) {
+    try { await statsChannelRemove(client, ban.user); } catch {}
+    try { purgeByUser(ban.user.id, ban.guild); } catch {}
+    try {
+        const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } = ban.user.client.logger
+        let auditLog = await getAuditLog(ban.guild, 'MEMBER_BAN_ADD')
+        let audit = auditLog.entries.filter(entry => entry.target.id == ban.user.id).first();
+        if (audit.executor.id == client.user.id) return
+        console.log(ban.reason)
+        let data = {
+            meta: {
+                type: 'memberBan',
+                displayName: 'Member Banned',
+                calculateType: 'guildMemberPunish',
+                color: NucleusColors.red,
+                emoji: "PUNISH.BAN.RED",
+                timestamp: new Date().getTime()
+            },
+            list: {
+                id: entry(ban.user.id, `\`${ban.user.id}\``),
+                name: entry(ban.user.id, renderUser(ban.user)),
+                banned: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+                bannedBy: entry(audit.executor.id, renderUser(audit.executor)),
+                reason: entry(audit.reason, audit.reason ? `\n> ${audit.reason}` : "*No reason provided.*"),
+                accountCreated: entry(ban.user.createdAt, renderDelta(ban.user.createdAt)),
+                serverMemberCount: ban.guild.memberCount,
+            },
+            hidden: {
+                guild: ban.guild.id
+            }
+        }
+        log(data, ban.user.client);
+    } catch {}
+}
diff --git a/src/events/guildBanRemove.ts b/src/events/guildBanRemove.ts
new file mode 100644
index 0000000..11661f7
--- /dev/null
+++ b/src/events/guildBanRemove.ts
@@ -0,0 +1,37 @@
+import humanizeDuration from 'humanize-duration';
+import { purgeByUser } from '../automations/tickets/delete.js';
+import { callback as statsChannelRemove } from '../automations/statsChannelRemove.js';
+
+export const event = 'guildBanRemove';
+
+export async function callback(client, ban) {
+    try { await statsChannelRemove(client, ban.user); } catch {}
+    try { purgeByUser(ban.user.id, ban.guild); } catch {}
+    try {
+        const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } = ban.user.client.logger
+        let auditLog = await getAuditLog(ban.guild, 'MEMBER_BAN_REMOVE')
+        let audit = auditLog.entries.filter(entry => entry.target.id == ban.user.id).first();
+        if (audit.executor.id == client.user.id) return
+        let data = {
+            meta: {
+                type: 'memberUnban',
+                displayName: 'Member Unbanned',
+                calculateType: 'guildMemberPunish',
+                color: NucleusColors.green,
+                emoji: "PUNISH.BAN.GREEN",
+                timestamp: new Date().getTime()
+            },
+            list: {
+                id: entry(ban.user.id, `\`${ban.user.id}\``),
+                name: entry(ban.user.id, renderUser(ban.user)),
+                unbanned: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+                unbannedBy: entry(audit.executor.id, renderUser(audit.executor)),
+                accountCreated: entry(ban.user.createdAt, renderDelta(ban.user.createdAt)),
+            },
+            hidden: {
+                guild: ban.guild.id
+            }
+        }
+        log(data, ban.user.client);
+    } catch (e) {console.log(e)}
+}
diff --git a/src/events/guildCreate.ts b/src/events/guildCreate.ts
index 4935b4d..0222c7c 100644
--- a/src/events/guildCreate.ts
+++ b/src/events/guildCreate.ts
@@ -6,5 +6,7 @@
 export const event = 'guildCreate';
 
 export async function callback(client, guild) {
-    guide(guild)
+    try{
+        guide(guild)
+    } catch {}
 }
diff --git a/src/events/guildMemberUpdate.ts b/src/events/guildMemberUpdate.ts
new file mode 100644
index 0000000..a1601bb
--- /dev/null
+++ b/src/events/guildMemberUpdate.ts
@@ -0,0 +1,36 @@
+import { callback as statsChannelAdd } from '../automations/statsChannelAdd.js';
+import { callback as welcome } from '../automations/welcome.js';
+import log from '../utils/log.js';
+export const event = 'guildMemberUpdate'
+
+export async function callback(client, before, after) {
+    try {
+        const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } = after.client.logger
+        if (before.nickname != after.nickname) {
+            let auditLog = await getAuditLog(after.guild, 'MEMBER_UPDATE');
+            let audit = auditLog.entries.filter(entry => entry.target.id == after.id).first();
+            if (audit.executor.id == client.user.id) return;
+            let data = {
+                meta: {
+                    type: 'memberUpdate',
+                    displayName: 'Nickname Changed',
+                    calculateType: 'guildMemberUpdate',
+                    color: NucleusColors.yellow,
+                    emoji: "PUNISH.NICKNAME.YELLOW",
+                    timestamp: new Date().getTime()
+                },
+                list: {
+                    id: entry(after.id, `\`${after.id}\``),
+                    before: entry(before.nickname, before.nickname ? before.nickname : '*None*'),
+                    after: entry(after.nickname, after.nickname ? after.nickname : '*None*'),
+                    updated: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+                    updatedBy: entry(audit.executor.id, renderUser(audit.executor))
+                },
+                hidden: {
+                    guild: after.guild.id
+                }
+            }
+            log(data, after.client);
+        }
+    } catch (e) { console.log(e) }
+}
diff --git a/src/events/guildUpdate.ts b/src/events/guildUpdate.ts
new file mode 100644
index 0000000..400cfe4
--- /dev/null
+++ b/src/events/guildUpdate.ts
@@ -0,0 +1,58 @@
+export const event = 'guildUpdate'
+
+export async function callback(client, before, after) {
+    try {
+        const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = after.client.logger
+        let auditLog = await getAuditLog(after, 'GUILD_UPDATE');
+        let audit = auditLog.entries.filter(entry => entry.target.id == after.id).first();
+        if (audit.executor.id == client.user.id) return;
+        let list = {}
+
+        const verificationLevels = {
+            NONE: 'Unrestricted',
+            LOW: 'Verified email',
+            MEDIUM: 'Registered (5 minutes)',
+            HIGH: 'Member (10 minutes)',
+            VERY_HIGH: 'Verified phone'
+        }
+
+        const explicitContentFilterLevels = {
+            DISABLED: 'Disabled',
+            MEMBERS_WITHOUT_ROLES: 'Members without roles',
+            ALL_MEMBERS: 'All members'
+        }
+
+        const MFALevels = {
+            NONE: 'None',
+            ELEVATED: 'Enabled'
+        }
+
+        if (before.name != after.name) list["name"] = entry([before.name, after.name], `${before.name} -> ${after.name}`);
+        if (before.icon != after.icon) list["icon"] = entry([before.icon, after.icon], `[Before](${before.iconURL()}) -> [After](${after.iconURL()})`);
+        if (before.splash != after.splash) list["splash"] = entry([before.splash, after.splash], `[Before](${before.splashURL()}) -> [After](${after.splashURL()})`);
+        if (before.banner != after.banner) list["banner"] = entry([before.banner, after.banner], `[Before](${before.bannerURL()}) -> [After](${after.bannerURL()})`);
+        if (before.owner != after.owner) list["owner"] = entry([before.owner, after.owner], `${renderUser(before.owner.user)} -> ${renderUser(after.owner.user)}`);
+        if (before.verificationLevel != after.verificationLevel) list["verificationLevel"] = entry([verificationLevels[before.verificationLevel], verificationLevels[after.verificationLevel]], `${verificationLevels[before.verificationLevel]} -> ${verificationLevels[after.verificationLevel]}`);
+        if (before.explicitContentFilter != after.explicitContentFilter) list["explicitContentFilter"] = entry([explicitContentFilterLevels[before.explicitContentFilter], explicitContentFilterLevels[after.explicitContentFilter]], `${explicitContentFilterLevels[before.explicitContentFilter]} -> ${explicitContentFilterLevels[after.explicitContentFilter]}`);
+        if (before.mfaLevel != after.mfaLevel) list["2 factor authentication"] = entry([MFALevels[before.mfaLevel], MFALevels[after.mfaLevel]], `${MFALevels[before.mfaLevel]} -> ${MFALevels[after.mfaLevel]}`);
+
+        if (!(Object.keys(list).length)) return;
+        list["updated"] = entry(new Date().getTime(), renderDelta(new Date().getTime()))
+        list["updatedBy"] = entry(audit.executor.id, renderUser(audit.executor))
+        let data = {
+            meta: {
+                type: 'guildUpdate',
+                displayName: 'Guild Edited',
+                calculateType: 'guildUpdate',
+                color: NucleusColors.yellow,
+                emoji: "GUILD.YELLOW",
+                timestamp: new Date().getTime()
+            },
+            list: list,
+            hidden: {
+                guild: after.id
+            }
+        }
+        log(data, after.client);
+    } catch (e) {}
+}
diff --git a/src/events/inviteCreate.ts b/src/events/inviteCreate.ts
new file mode 100644
index 0000000..bdfeede
--- /dev/null
+++ b/src/events/inviteCreate.ts
@@ -0,0 +1,32 @@
+import humanizeDuration from 'humanize-duration';
+export const event = 'inviteCreate'
+
+export async function callback(client, invite) {
+    try {
+        const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = invite.client.logger
+        let auditLog = await getAuditLog(invite.guild, 'INVITE_CREATE');
+        let audit = auditLog.entries.filter(entry => entry.target.id == invite.id).first();
+        if (audit.executor.id == client.user.id) return;
+        let data = {
+            meta: {
+                type: 'inviteCreate',
+                displayName: 'Invite Created',
+                calculateType: 'guildUpdate',
+                color: NucleusColors.green,
+                emoji: "INVITE.CREATE",
+                timestamp: invite.createdTimestamp
+            },
+            list: {
+                channel: entry(invite.channel.id, renderChannel(invite.channel)),
+                link: entry(invite.url, invite.url),
+                expires: entry(invite.maxAge, invite.maxAge ? humanizeDuration(invite.maxAge * 1000) : 'Never'),
+                createdBy: entry(audit.executor.id, renderUser(audit.executor)),
+                created: entry(invite.createdTimestamp, renderDelta(invite.createdTimestamp))
+            },
+            hidden: {
+                guild: invite.guild.id
+            }
+        }
+        log(data, invite.client);
+    } catch {}
+}
diff --git a/src/events/inviteDelete.ts b/src/events/inviteDelete.ts
new file mode 100644
index 0000000..dec234f
--- /dev/null
+++ b/src/events/inviteDelete.ts
@@ -0,0 +1,32 @@
+import humanizeDuration from 'humanize-duration';
+export const event = 'inviteDelete'
+
+export async function callback(client, invite) {
+    try {
+        const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = invite.client.logger
+        let auditLog = await getAuditLog(invite.guild, 'INVITE_DELETE');
+        let audit = auditLog.entries.filter(entry => entry.target.id == invite.id).first();
+        if (audit.executor.id == client.user.id) return;
+        let data = {
+            meta: {
+                type: 'inviteDelete',
+                displayName: 'Invite Deleted',
+                calculateType: 'guildUpdate',
+                color: NucleusColors.red,
+                emoji: "INVITE.DELETE",
+                timestamp: new Date().getTime()
+            },
+            list: {
+                channel: entry(invite.channel.id, renderChannel(invite.channel)),
+                link: entry(invite.url, invite.url),
+                expires: entry(invite.maxAge, invite.maxAge ? humanizeDuration(invite.maxAge * 1000) : 'Never'),
+                deletedBy: entry(audit.executor.id, renderUser(audit.executor)),
+                deleted: entry(new Date().getTime(), renderDelta(new Date().getTime()))
+            },
+            hidden: {
+                guild: invite.guild.id
+            }
+        }
+        log(data, invite.client);
+    } catch {}
+}
diff --git a/src/events/memberLeave.ts b/src/events/memberLeave.ts
index ea461ab..22b7cd3 100644
--- a/src/events/memberLeave.ts
+++ b/src/events/memberLeave.ts
@@ -4,31 +4,67 @@
 
 export const event = 'guildMemberRemove'
 
-export async function callback(_, member) {
-    try { await statsChannelRemove(_, member); } catch {}
-    try { purgeByUser(member.id, member.guild); } catch {} // TODO: add this to ban as well
+export async function callback(client, member) {
+    try { await statsChannelRemove(client, member); } catch {}
+    try { purgeByUser(member.id, member.guild); } catch {}
     try {
-        const { log, NucleusColors, entry, renderUser, renderDelta } = member.client.logger
-        let data = {
-            meta: {
-                type: 'memberLeave',
-                displayName: 'Member Left',
-                calculateType: 'guildMemberUpdate',
-                color: NucleusColors.red,
-                emoji: "MEMBER" + (member.user.bot ? ".BOT" : "") + ".LEAVE",
-                timestamp: new Date().getTime()
-            },
-            list: {
-                id: entry(member.id, `\`${member.id}\``),
-                name: entry(member.id, renderUser(member.user)),
-                joined: entry(member.joinedAt, renderDelta(member.joinedAt)),
-                left: entry(new Date().getTime(), renderDelta(new Date().getTime())),
-                timeInServer: entry(new Date().getTime() - member.joinedAt, humanizeDuration(new Date().getTime() - member.joinedAt, { round: true })),
-                accountCreated: entry(member.user.createdAt, renderDelta(member.user.createdAt)),
-                serverMemberCount: member.guild.memberCount,
-            },
-            hidden: {
-                guild: member.guild.id
+        const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = member.client.logger
+        let auditLog = await getAuditLog(member.guild, 'MEMBER_KICK');
+        let audit = auditLog.entries.filter(entry => entry.target.id == member.id).first();
+        let type = "kick"
+        if (audit) {
+            if (audit.createdAt - 100 < new Date().getTime()) {
+                type = "leave"
+            } else if (audit.executor.id == client.user.id) return
+        }
+        let data
+        if (type == "kick") {
+            data = {
+                meta: {
+                    type: 'memberKick',
+                    displayName: 'Member Kicked',
+                    calculateType: 'guildMemberPunish',
+                    color: NucleusColors.red,
+                    emoji: "PUNISH.KICK.RED",
+                    timestamp: new Date().getTime()
+                },
+                list: {
+                    id: entry(member.id, `\`${member.id}\``),
+                    name: entry(member.id, renderUser(member.user)),
+                    joined: entry(member.joinedAt, renderDelta(member.joinedAt)),
+                    kicked: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+                    kickedBy: entry(audit.executor.id, renderUser(audit.executor)),
+                    reason: entry(audit.reason, audit.reason ? `\n> ${audit.reason}` : "*No reason provided.*"),
+                    timeInServer: entry(new Date().getTime() - member.joinedAt, humanizeDuration(new Date().getTime() - member.joinedAt, { round: true })),
+                    accountCreated: entry(member.user.createdAt, renderDelta(member.user.createdAt)),
+                    serverMemberCount: member.guild.memberCount,
+                },
+                hidden: {
+                    guild: member.guild.id
+                }
+            }
+        } else {
+            data = {
+                meta: {
+                    type: 'memberLeave',
+                    displayName: 'Member Left',
+                    calculateType: 'guildMemberUpdate',
+                    color: NucleusColors.red,
+                    emoji: "MEMBER." + (member.bot ? "BOT." : "") + "LEAVE",
+                    timestamp: new Date().getTime()
+                },
+                list: {
+                    id: entry(member.id, `\`${member.id}\``),
+                    name: entry(member.id, renderUser(member.user)),
+                    joined: entry(member.joinedTimestamp, renderDelta(member.joinedAt)),
+                    left: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+                    timeInServer: entry(new Date().getTime() - member.joinedTimestamp, humanizeDuration(new Date().getTime() - member.joinedAt, { round: true })),
+                    accountCreated: entry(member.user.createdAt, renderDelta(member.user.createdAt)),
+                    serverMemberCount: member.guild.memberCount,
+                },
+                hidden: {
+                    guild: member.guild.id
+                }
             }
         }
         log(data, member.client);
diff --git a/src/events/messageChecks.ts b/src/events/messageChecks.ts
index 83cfff1..4e99c61 100644
--- a/src/events/messageChecks.ts
+++ b/src/events/messageChecks.ts
@@ -1,101 +1,100 @@
 import { LinkCheck, MalwareCheck, NSFWCheck, SizeCheck, TestString, TestImage } from '../automations/unscan.js'
-import readConfig from '../utils/readConfig.js'
 import { Message } from 'discord.js'
 
 export const event = 'messageCreate'
 
-export async function callback(_, message) {
-	if (message.author.bot) return
-	if (message.channel.type === 'dm') return
+export async function callback(client, message) {
+    if (message.author.bot) return
+    if (message.channel.type === 'dm') return
 
-	let content = message.content.toLowerCase() || ''
-	let config = await readConfig(message.guild.id);
+    let content = message.content.toLowerCase() || ''
+    let config = await client.memory.readGuildInfo(message.guild.id);
 
-	if (config.filters.invite.enabled) {
-		if (!config.filters.invite.allowed.users.includes(message.author.id) ||
-			!config.filters.invite.allowed.channels.includes(message.channel.id) ||
-			!message.author.roles.cache.some(role => config.filters.invite.allowed.roles.includes(role.id))
-		) {
-			if ((/(?:https?:\/\/)?discord(?:app)?\.(?:com\/invite|gg)\/[a-zA-Z0-9]+\/?/.test(content))) {
-				message.delete();
-				return toLog(message, 'invite', content.match(/(?:https?:\/\/)?discord(?:app)?\.(?:com\/invite|gg)\/[a-zA-Z0-9]+\/?/))
-			}
-		}
-	}
+    if (config.filters.invite.enabled) {
+        if (!config.filters.invite.allowed.users.includes(message.author.id) ||
+            !config.filters.invite.allowed.channels.includes(message.channel.id) ||
+            !message.author.roles.cache.some(role => config.filters.invite.allowed.roles.includes(role.id))
+        ) {
+            if ((/(?:https?:\/\/)?discord(?:app)?\.(?:com\/invite|gg)\/[a-zA-Z0-9]+\/?/.test(content))) {
+                message.delete();
+                return toLog(message, 'invite', content.match(/(?:https?:\/\/)?discord(?:app)?\.(?:com\/invite|gg)\/[a-zA-Z0-9]+\/?/))
+            }
+        }
+    }
 
-	let attachments = message.attachments.map(element => element)
-	attachments = [...attachments, ...content.match(
-		/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi
-	) ?? []].filter(element => (element.url ? element.url : element))
-	if (attachments.length > 0) {
-		attachments.forEach(async element => {
-			if(!message) return;
-			let url = element.url ? element.url : element
-			if (url != undefined) {
-				if(/\.+(webp|png|jpg|jpeg|bmp)/.test(url)) {
-					if (config.filters.images.NSFW && !message.channel.nsfw) {
-						if (await NSFWCheck(url)) {
-							await message.delete()
-							return toLog(message, 'NSFW', url)
-						}
-					}
-					if (config.filters.images.size) {
-						if(!url.match(/\.+(webp|png|jpg)$/gi)) return
-						if(!await SizeCheck(element)) {
-							await message.delete()
-							return toLog(message, 'size', url)
-						}
-					}
-				}
-				if (config.filters.malware) {
-					if (!MalwareCheck(url)) {
-						await message.delete()
-						return toLog(message, 'malware', url)
-					}
-				}
-			}
-		});
-	}
-	if(!message) return;
+    let attachments = message.attachments.map(element => element)
+    attachments = [...attachments, ...content.match(
+        /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi
+    ) ?? []].filter(element => (element.url ? element.url : element))
+    if (attachments.length > 0) {
+        attachments.forEach(async element => {
+            if(!message) return;
+            let url = element.url ? element.url : element
+            if (url != undefined) {
+                if(/\.+(webp|png|jpg|jpeg|bmp)/.test(url)) {
+                    if (config.filters.images.NSFW && !message.channel.nsfw) {
+                        if (await NSFWCheck(url)) {
+                            await message.delete()
+                            return toLog(message, 'NSFW', url)
+                        }
+                    }
+                    if (config.filters.images.size) {
+                        if(!url.match(/\.+(webp|png|jpg)$/gi)) return
+                        if(!await SizeCheck(element)) {
+                            await message.delete()
+                            return toLog(message, 'size', url)
+                        }
+                    }
+                }
+                if (config.filters.malware) {
+                    if (!MalwareCheck(url)) {
+                        await message.delete()
+                        return toLog(message, 'malware', url)
+                    }
+                }
+            }
+        });
+    }
+    if(!message) return;
 
-	if (await LinkCheck(message)) {
-		await message.delete()
-		return toLog(message, 'link')
-	}
+    if (await LinkCheck(message)) {
+        await message.delete()
+        return toLog(message, 'link')
+    }
 
-	if (config.filters.wordFilter.enabled) {
-		let check = TestString(content, config.filters.wordFilter.words.loose, config.filters.wordFilter.words.strict)
-		if(check != "none") {
-			await message.delete()
-			return toLog(message, 'wordFilter', content)
-		}
-	}
+    if (config.filters.wordFilter.enabled) {
+        let check = TestString(content, config.filters.wordFilter.words.loose, config.filters.wordFilter.words.strict)
+        if(check != "none") {
+            await message.delete()
+            return toLog(message, 'wordFilter', content)
+        }
+    }
 
-	if (!config.filters.pings.allowed.users.includes(message.author.id) ||
-		!config.filters.pings.allowed.channels.includes(message.channel.id) ||
-		!message.author.roles.cache.some(role => config.filters.pings.allowed.roles.includes(role.id))
-	) {
-		if (config.filters.pings.everyone && message.mentions.everyone) {
-			message.delete();
-			return toLog(message, 'mention everyone')
-		}
-		if (config.filters.pings.roles) {
-			for(let role of message.mentions.roles) {
-				if(!message) return;
-				if (!config.filters.pings.allowed.roles.includes(role.id)) {
-					message.delete();
-					return toLog(message, 'mention role')
-				}
-			}
-		}
-		if(!message) return;
-		if (message.mentions.users.size >= config.filters.pings.mass && config.filters.pings.mass) {
-			message.delete();
-			return toLog(message, 'Mass Pings')
-		}
-	}
+    if (!config.filters.pings.allowed.users.includes(message.author.id) ||
+        !config.filters.pings.allowed.channels.includes(message.channel.id) ||
+        !message.author.roles.cache.some(role => config.filters.pings.allowed.roles.includes(role.id))
+    ) {
+        if (config.filters.pings.everyone && message.mentions.everyone) {
+            message.delete();
+            return toLog(message, 'mention everyone')
+        }
+        if (config.filters.pings.roles) {
+            for(let role of message.mentions.roles) {
+                if(!message) return;
+                if (!config.filters.pings.allowed.roles.includes(role.id)) {
+                    message.delete();
+                    return toLog(message, 'mention role')
+                }
+            }
+        }
+        if(!message) return;
+        if (message.mentions.users.size >= config.filters.pings.mass && config.filters.pings.mass) {
+            message.delete();
+            return toLog(message, 'Mass Pings')
+        }
+    }
 }
 
 async function toLog(message: Message, reason: string, data?: any) {
-	// log(message.guild.id, {type: reason, data: data})
+    // log(message.guild.id, {type: reason, data: data})
 }
diff --git a/src/events/messageDelete.ts b/src/events/messageDelete.ts
index ccaacb8..f0f5e00 100644
--- a/src/events/messageDelete.ts
+++ b/src/events/messageDelete.ts
@@ -1,38 +1,45 @@
 export const event = 'messageDelete'
 
 export async function callback(client, message) {
-    if (message.author.id == client.user.id) return;
-	const { log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = message.channel.client.logger
-    message.reference = message.reference || {}
-    let content = message.cleanContent
-    if (content.length > 256) content = content.substring(0, 253) + '...'
-    let data = {
-        meta: {
-            type: 'messageDelete',
-            displayName: 'Message Deleted',
-            calculateType: 'messageDelete',
-            color: NucleusColors.red,
-            emoji: 'MESSAGE.DELETE',
-            timestamp: new Date().getTime()
-        },
-        separate: {
-            start: content ? `**Message:**\n\`\`\`${content}\`\`\`` : '**Message:** *Message had no content*',
-        },
-        list: {
-            id: entry(message.id, `\`${message.id}\``),
-            sentBy: entry(message.author.id, renderUser(message.author)),
-            sentIn: entry(message.channel.id, renderChannel(message.channel)),
-            deleted: entry(new Date(message.createdTimestamp), renderDelta(new Date(message.createdTimestamp))),
-            mentions: message.mentions.users.size,
-            attachments: message.attachments.size,
-            repliedTo: entry(
-                message.reference.messageId || null,
-                message.reference.messageId ? `[[Jump to message]](https://discord.com/channels/${message.guild.id}/${message.channel.id}/${message.reference.messageId})` : "None"
-            )
-        },
-        hidden: {
-            guild: message.channel.guild.id
+    try {
+        if (message.author.id == client.user.id) return;
+        const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = message.channel.client.logger
+        let auditLog = await getAuditLog(message.guild, 'MEMBER_BAN_ADD')
+        let audit = auditLog.entries.filter(entry => entry.target.id == message.author.id).first();
+        if (audit) {
+            if (audit.createdAt - 100 < new Date().getTime()) return;
         }
-    }
-    log(data, client);
+        message.reference = message.reference || {}
+        let content = message.cleanContent
+        if (content.length > 256) content = content.substring(0, 253) + '...'
+        let data = {
+            meta: {
+                type: 'messageDelete',
+                displayName: 'Message Deleted',
+                calculateType: 'messageDelete',
+                color: NucleusColors.red,
+                emoji: 'MESSAGE.DELETE',
+                timestamp: new Date().getTime()
+            },
+            separate: {
+                start: content ? `**Message:**\n\`\`\`${content}\`\`\`` : '**Message:** *Message had no content*',
+            },
+            list: {
+                id: entry(message.id, `\`${message.id}\``),
+                sentBy: entry(message.author.id, renderUser(message.author)),
+                sentIn: entry(message.channel.id, renderChannel(message.channel)),
+                deleted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+                mentions: message.mentions.users.size,
+                attachments: message.attachments.size,
+                repliedTo: entry(
+                    message.reference.messageId || null,
+                    message.reference.messageId ? `[[Jump to message]](https://discord.com/channels/${message.guild.id}/${message.channel.id}/${message.reference.messageId})` : "None"
+                )
+            },
+            hidden: {
+                guild: message.channel.guild.id
+            }
+        }
+        log(data, client);
+    } catch {}
 }
diff --git a/src/events/messageEdit.ts b/src/events/messageEdit.ts
index 318b0ef..ec713a2 100644
--- a/src/events/messageEdit.ts
+++ b/src/events/messageEdit.ts
@@ -1,44 +1,46 @@
 export const event = 'messageUpdate'
 
 export async function callback(client, oldMessage, newMessage) {
-    if (newMessage.author.id == client.user.id) return;
-	const { log, NucleusColors, entry, renderUser, renderDelta, renderNumberDelta, renderChannel } = newMessage.channel.client.logger
-    newMessage.reference = newMessage.reference || {}
-    let newContent = newMessage.cleanContent.replaceAll("`", "‘")
-    let oldContent = oldMessage.cleanContent.replaceAll("`", "‘")
-    if (newContent == oldContent) return;
-    if (newContent.length > 256) newContent = newContent.substring(0, 253) + '...'
-    if (oldContent.length > 256) oldContent = oldContent.substring(0, 253) + '...'
-    let data = {
-        meta: {
-            type: 'messageUpdate',
-            displayName: 'Message Edited',
-            calculateType: 'messageUpdate',
-            color: NucleusColors.yellow,
-            emoji: 'MESSAGE.EDIT',
-            timestamp: newMessage.editedTimestamp
-        },
-        separate: {
-            start: (oldContent ? `**Before:**\n\`\`\`\n${oldContent}\n\`\`\`\n` : '**Before:** *Message had no content*\n') +
-                   (newContent ? `**After:**\n\`\`\`\n${newContent}\n\`\`\`` : '**After:** *Message had no content*'),
-            end: `[[Jump to message]](${newMessage.url})`
-        },
-        list: {
-            id: entry(newMessage.id, `\`${newMessage.id}\``),
-            sentBy: entry(newMessage.author.id, renderUser(newMessage.author)),
-            sentIn: entry(newMessage.channel.id, renderChannel(newMessage.channel)),
-            sent: entry(new Date(newMessage.createdTimestamp), renderDelta(new Date(newMessage.createdTimestamp))),
-            edited: entry(new Date(newMessage.editedTimestamp), renderDelta(new Date(newMessage.editedTimestamp))),
-            mentions: renderNumberDelta(oldMessage.mentions.users.size, newMessage.mentions.users.size),
-            attachments: renderNumberDelta(oldMessage.attachments.size, newMessage.attachments.size),
-            repliedTo: entry(
-                newMessage.reference.messageId || null,
-                newMessage.reference.messageId ? `[[Jump to message]](https://discord.com/channels/${newMessage.guild.id}/${newMessage.channel.id}/${newMessage.reference.messageId})` : "None"
-            )
-        },
-        hidden: {
-            guild: newMessage.channel.guild.id
+    try {
+        if (newMessage.author.id == client.user.id) return;
+        const { log, NucleusColors, entry, renderUser, renderDelta, renderNumberDelta, renderChannel } = newMessage.channel.client.logger
+        newMessage.reference = newMessage.reference || {}
+        let newContent = newMessage.cleanContent.replaceAll("`", "‘")
+        let oldContent = oldMessage.cleanContent.replaceAll("`", "‘")
+        if (newContent == oldContent) return;
+        if (newContent.length > 256) newContent = newContent.substring(0, 253) + '...'
+        if (oldContent.length > 256) oldContent = oldContent.substring(0, 253) + '...'
+        let data = {
+            meta: {
+                type: 'messageUpdate',
+                displayName: 'Message Edited',
+                calculateType: 'messageUpdate',
+                color: NucleusColors.yellow,
+                emoji: 'MESSAGE.EDIT',
+                timestamp: newMessage.editedTimestamp
+            },
+            separate: {
+                start: (oldContent ? `**Before:**\n\`\`\`\n${oldContent}\n\`\`\`\n` : '**Before:** *Message had no content*\n') +
+                    (newContent ? `**After:**\n\`\`\`\n${newContent}\n\`\`\`` : '**After:** *Message had no content*'),
+                end: `[[Jump to message]](${newMessage.url})`
+            },
+            list: {
+                id: entry(newMessage.id, `\`${newMessage.id}\``),
+                sentBy: entry(newMessage.author.id, renderUser(newMessage.author)),
+                sentIn: entry(newMessage.channel.id, renderChannel(newMessage.channel)),
+                sent: entry(new Date(newMessage.createdTimestamp), renderDelta(new Date(newMessage.createdTimestamp))),
+                edited: entry(new Date(newMessage.editedTimestamp), renderDelta(new Date(newMessage.editedTimestamp))),
+                mentions: renderNumberDelta(oldMessage.mentions.users.size, newMessage.mentions.users.size),
+                attachments: renderNumberDelta(oldMessage.attachments.size, newMessage.attachments.size),
+                repliedTo: entry(
+                    newMessage.reference.messageId || null,
+                    newMessage.reference.messageId ? `[[Jump to message]](https://discord.com/channels/${newMessage.guild.id}/${newMessage.channel.id}/${newMessage.reference.messageId})` : "None"
+                )
+            },
+            hidden: {
+                guild: newMessage.channel.guild.id
+            }
         }
-    }
-    log(data, client);
+        log(data, client);
+    } catch {}
 }
diff --git a/src/events/roleCreate.ts b/src/events/roleCreate.ts
index 76af433..2664790 100644
--- a/src/events/roleCreate.ts
+++ b/src/events/roleCreate.ts
@@ -1,29 +1,31 @@
 export const event = 'roleCreate'
 
 export async function callback(client, role) {
-	const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderRole } = role.client.logger
-    if (role.managed) return;
-    let auditLog = await getAuditLog(role.guild, 'ROLE_CREATE');
-    let audit = auditLog.entries.filter(entry => entry.target.id == role.id).first();
-    if (audit.executor.id == client.user.id) return;
-    let data = {
-        meta: {
-            type: 'roleCreate',
-            displayName: 'Role Created',
-            calculateType: 'guildRoleUpdate',
-            color: NucleusColors.green,
-            emoji: "GUILD.ROLES.CREATE",
-            timestamp: role.createdTimestamp
-        },
-        list: {
-            id: entry(role.id, `\`${role.id}\``),
-            role: entry(role.name, renderRole(role)),
-            createdBy: entry(audit.executor.id, renderUser(audit.executor)),
-            created: entry(role.createdTimestamp, renderDelta(role.createdTimestamp))
-        },
-        hidden: {
-            guild: role.guild.id
+    try {
+        const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderRole } = role.client.logger
+        if (role.managed) return;
+        let auditLog = await getAuditLog(role.guild, 'ROLE_CREATE');
+        let audit = auditLog.entries.filter(entry => entry.target.id == role.id).first();
+        if (audit.executor.id == client.user.id) return;
+        let data = {
+            meta: {
+                type: 'roleCreate',
+                displayName: 'Role Created',
+                calculateType: 'guildRoleUpdate',
+                color: NucleusColors.green,
+                emoji: "GUILD.ROLES.CREATE",
+                timestamp: role.createdTimestamp
+            },
+            list: {
+                id: entry(role.id, `\`${role.id}\``),
+                role: entry(role.name, renderRole(role)),
+                createdBy: entry(audit.executor.id, renderUser(audit.executor)),
+                created: entry(role.createdTimestamp, renderDelta(role.createdTimestamp))
+            },
+            hidden: {
+                guild: role.guild.id
+            }
         }
-    }
-    log(data, client);
+        log(data, client);
+    } catch {}
 }
diff --git a/src/events/roleDelete.ts b/src/events/roleDelete.ts
index c5cbe63..6edfeed 100644
--- a/src/events/roleDelete.ts
+++ b/src/events/roleDelete.ts
@@ -3,34 +3,36 @@
 export const event = 'roleDelete'
 
 export async function callback(client, role) {
-	const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = role.client.logger
-    if (role.managed) return;
-    let auditLog = await getAuditLog(role.guild, 'ROLE_DELETE');
-    let audit = auditLog.entries.filter(entry => entry.target.id == role.id).first();
-    if (audit.executor.id == client.user.id) return;
-    let data = {
-        meta: {
-            type: 'roleDelete',
-            displayName: 'Role Deleted',
-            calculateType: 'guildRoleUpdate',
-            color: NucleusColors.red,
-            emoji: "GUILD.ROLES.DELETE",
-            timestamp: audit.createdTimestamp,
-        },
-        list: {
-            id: entry(role.id, `\`${role.id}\``),
-            role: entry(role.name, role.name),
-            color: entry(role.hexColor, `\`${role.hexColor}\``),
-            showInMemberList: entry(role.hoist, role.hoist ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`),
-            mentionable: entry(role.mentionable, role.mentionable ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`),
-            members: entry(role.members.size, `${role.members.size}`),
-            deletedBy: entry(audit.executor.id, renderUser(audit.executor)),
-            created: entry(role.createdTimestamp, renderDelta(role.createdTimestamp)),
-            deleted: entry(new Date().getTime(), renderDelta(new Date().getTime()))
-        },
-        hidden: {
-            guild: role.guild.id
+    try {
+        const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = role.client.logger
+        if (role.managed) return;
+        let auditLog = await getAuditLog(role.guild, 'ROLE_DELETE');
+        let audit = auditLog.entries.filter(entry => entry.target.id == role.id).first();
+        if (audit.executor.id == client.user.id) return;
+        let data = {
+            meta: {
+                type: 'roleDelete',
+                displayName: 'Role Deleted',
+                calculateType: 'guildRoleUpdate',
+                color: NucleusColors.red,
+                emoji: "GUILD.ROLES.DELETE",
+                timestamp: audit.createdTimestamp,
+            },
+            list: {
+                id: entry(role.id, `\`${role.id}\``),
+                role: entry(role.name, role.name),
+                color: entry(role.hexColor, `\`${role.hexColor}\``),
+                showInMemberList: entry(role.hoist, role.hoist ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`),
+                mentionable: entry(role.mentionable, role.mentionable ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`),
+                members: entry(role.members.size, `${role.members.size}`),
+                deletedBy: entry(audit.executor.id, renderUser(audit.executor)),
+                created: entry(role.createdTimestamp, renderDelta(role.createdTimestamp)),
+                deleted: entry(new Date().getTime(), renderDelta(new Date().getTime()))
+            },
+            hidden: {
+                guild: role.guild.id
+            }
         }
-    }
-    log(data, client);
+        log(data, client);
+    } catch {}
 }
diff --git a/src/events/roleUpdate.ts b/src/events/roleUpdate.ts
index 28afe0e..faf3237 100644
--- a/src/events/roleUpdate.ts
+++ b/src/events/roleUpdate.ts
@@ -3,43 +3,45 @@
 export const event = 'roleUpdate';
 
 export async function callback(client, or, nr) {
-	const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser, renderRole } = client.logger
+    try {
+        const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser, renderRole } = client.logger
 
-	let auditLog = await getAuditLog(nr.guild, 'ROLE_UPDATE');
-	let audit = auditLog.entries.first();
-    if (audit.executor.id == client.user.id) return;
+        let auditLog = await getAuditLog(nr.guild, 'ROLE_UPDATE');
+        let audit = auditLog.entries.first();
+        if (audit.executor.id == client.user.id) return;
 
-	let changes = {
-		id: entry(nr.id, `\`${nr.id}\``),
-		role: entry(nr.id, renderRole(nr)),
-		edited: entry(nr.createdTimestamp, renderDelta(nr.createdTimestamp)),
-		editedBy: entry(audit.executor.id, renderUser((await nr.guild.members.fetch(audit.executor.id)).user)),
-	}
-    let mentionable = ["", ""]
-    let hoist = ["", ""]
-    mentionable[0] = or.mentionable ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`
-    mentionable[1] = nr.mentionable ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`
-    hoist[0] = or.hoist ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`
-    hoist[1] = nr.hoist ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`
-	if (or.name != nr.name) changes["name"] = entry([or.name, nr.name], `${or.name} -> ${nr.name}`);
-	if (or.position != nr.position) changes["position"] = entry([or.position, nr.position], `${or.position} -> ${nr.position}`);
-    if (or.hoist != nr.hoist) changes["showInMemberList"] = entry([or.hoist, nr.hoist], `${hoist[0]} -> ${hoist[1]}`);
-    if (or.mentionable != nr.mentionable) changes["mentionable"] = entry([or.mentionable, nr.mentionable], `${mentionable[0]} -> ${mentionable[1]}`);
-    if (or.hexColor != nr.hexColor) changes["color"] = entry([or.hexColor, nr.hexColor], `\`${or.hexColor}\` -> \`${nr.hexColor}\``);
+        let changes = {
+            id: entry(nr.id, `\`${nr.id}\``),
+            role: entry(nr.id, renderRole(nr)),
+            edited: entry(nr.createdTimestamp, renderDelta(nr.createdTimestamp)),
+            editedBy: entry(audit.executor.id, renderUser((await nr.guild.members.fetch(audit.executor.id)).user)),
+        }
+        let mentionable = ["", ""]
+        let hoist = ["", ""]
+        mentionable[0] = or.mentionable ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`
+        mentionable[1] = nr.mentionable ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`
+        hoist[0] = or.hoist ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`
+        hoist[1] = nr.hoist ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`
+        if (or.name != nr.name) changes["name"] = entry([or.name, nr.name], `${or.name} -> ${nr.name}`);
+        if (or.position != nr.position) changes["position"] = entry([or.position, nr.position], `${or.position} -> ${nr.position}`);
+        if (or.hoist != nr.hoist) changes["showInMemberList"] = entry([or.hoist, nr.hoist], `${hoist[0]} -> ${hoist[1]}`);
+        if (or.mentionable != nr.mentionable) changes["mentionable"] = entry([or.mentionable, nr.mentionable], `${mentionable[0]} -> ${mentionable[1]}`);
+        if (or.hexColor != nr.hexColor) changes["color"] = entry([or.hexColor, nr.hexColor], `\`${or.hexColor}\` -> \`${nr.hexColor}\``);
 
-	let data = {
-		meta:{
-			type: 'roleUpdate',
-			displayName: 'Role Edited',
-			calculateType: 'guildRoleUpdate',
-			color: NucleusColors.yellow,
-			emoji: "GUILD.ROLES.EDIT",
-			timestamp: audit.createdTimestamp
-		},
-		list: changes,
-		hidden: {
-			guild: nr.guild.id
-		}
-	}
-	log(data, client);
+        let data = {
+            meta:{
+                type: 'roleUpdate',
+                displayName: 'Role Edited',
+                calculateType: 'guildRoleUpdate',
+                color: NucleusColors.yellow,
+                emoji: "GUILD.ROLES.EDIT",
+                timestamp: audit.createdTimestamp
+            },
+            list: changes,
+            hidden: {
+                guild: nr.guild.id
+            }
+        }
+        log(data, client);
+    } catch {}
 }
\ No newline at end of file
diff --git a/src/events/threadCreate.ts b/src/events/threadCreate.ts
new file mode 100644
index 0000000..77e9dea
--- /dev/null
+++ b/src/events/threadCreate.ts
@@ -0,0 +1,34 @@
+import humanizeDuration from 'humanize-duration';
+export const event = 'threadCreate'
+
+export async function callback(client, thread) {
+    try {
+        const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = thread.client.logger
+        let auditLog = await getAuditLog(thread.guild, 'THREAD_CREATE');
+        let audit = auditLog.entries.filter(entry => entry.target.id == thread.id).first();
+        if (audit.executor.id == client.user.id) return;
+        let data = {
+            meta: {
+                type: 'channelCreate',
+                displayName: 'Thread Created',
+                calculateType: 'channelUpdate',
+                color: NucleusColors.green,
+                emoji: "CHANNEL.TEXT.CREATE",
+                timestamp: thread.createdTimestamp
+            },
+            list: {
+                id: entry(thread.id, `\`${thread.id}\``),
+                name: entry(thread.name, renderChannel(thread)),
+                parentChannel: entry(thread.parentId, renderChannel(thread.parent)),
+                category: entry(thread.parent.parent ? thread.parent.parent.name : 'None', thread.parent.parent ? renderChannel(thread.parent.parent) : 'None'),
+                autoArchiveDuration: entry(thread.autoArchiveDuration, humanizeDuration(thread.autoArchiveDuration * 60 * 1000, { round: true })),
+                createdBy: entry(audit.executor.id, renderUser(audit.executor)),
+                created: entry(thread.createdTimestamp, renderDelta(thread.createdTimestamp))
+            },
+            hidden: {
+                guild: thread.guild.id
+            }
+        }
+        log(data, thread.client);
+    } catch {}
+}
diff --git a/src/events/threadDelete.ts b/src/events/threadDelete.ts
new file mode 100644
index 0000000..7bf8537
--- /dev/null
+++ b/src/events/threadDelete.ts
@@ -0,0 +1,36 @@
+import humanizeDuration from 'humanize-duration';
+export const event = 'threadDelete'
+
+export async function callback(client, thread) {
+    try {
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = thread.client.logger
+    let auditLog = await getAuditLog(thread.guild, 'THREAD_UPDATE');
+    let audit = auditLog.entries.filter(entry => entry.target.id == thread.id).first();
+    if (audit.executor.id == client.user.id) return;
+    let data = {
+        meta: {
+            type: 'channelDelete',
+            displayName: 'Thread Deleted',
+            calculateType: 'channelUpdate',
+            color: NucleusColors.red,
+            emoji: "CHANNEL.TEXT.DELETE",
+            timestamp: new Date().getTime()
+        },
+        list: {
+            id: entry(thread.id, `\`${thread.id}\``),
+            name: entry(thread.name, thread.name),
+            parentChannel: entry(thread.parentId, renderChannel(thread.parent)),
+            category: entry(thread.parent.parent ? thread.parent.parent.name : 'None', thread.parent.parent ? renderChannel(thread.parent.parent) : 'None'),
+            autoArchiveDuration: entry(thread.autoArchiveDuration, humanizeDuration(thread.autoArchiveDuration * 60 * 1000, { round: true })),
+            membersInThread: entry(thread.memberCount, thread.memberCount),
+            deletedBy: entry(audit.executor.id, renderUser(audit.executor)),
+            created: entry(thread.createdTimestamp, renderDelta(thread.createdTimestamp)),
+            deleted: entry(new Date().getTime(), renderDelta(new Date().getTime()))
+        },
+        hidden: {
+            guild: thread.guild.id
+        }
+    }
+    log(data, thread.client);
+    } catch {}
+}
diff --git a/src/events/threadUpdate.ts b/src/events/threadUpdate.ts
new file mode 100644
index 0000000..4067eba
--- /dev/null
+++ b/src/events/threadUpdate.ts
@@ -0,0 +1,43 @@
+import humanizeDuration from 'humanize-duration';
+export const event = 'threadUpdate'
+
+export async function callback(client, before, after) {
+    try {
+        const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = after.client.logger
+        let auditLog = await getAuditLog(after.guild, 'THREAD_UPDATE');
+        let audit = auditLog.entries.filter(entry => entry.target.id == after.id).first();
+        if (audit.executor.id == client.user.id) return;
+        let list = {
+            id: entry(after.id, `\`${after.id}\``),
+            thread: entry(after.name, renderChannel(after)),
+            parentChannel: entry(after.parentId, renderChannel(after.parent)),
+        }
+        if (before.name != after.name) {
+            list["name"] = entry([before.name, after.name], `${before.name} -> ${after.name}`);
+        }
+        if (before.autoArchiveDuration != after.autoArchiveDuration) {
+            list["autoArchiveDuration"] = entry([before.autoArchiveDuration, after.autoArchiveDuration], `${humanizeDuration(before.autoArchiveDuration * 60 * 1000, { round: true })} -> ${humanizeDuration(after.autoArchiveDuration * 60 * 1000, { round: true })}`);
+        }
+        if (before.rateLimitPerUser != after.rateLimitPerUser) {
+            list["slowmode"] = entry([before.rateLimitPerUser, after.rateLimitPerUser], `${humanizeDuration(before.rateLimitPerUser * 1000)} -> ${humanizeDuration(after.rateLimitPerUser * 1000)}`);
+        }
+        if (!(Object.keys(list).length - 3)) return;
+        list["updated"] = entry(new Date().getTime(), renderDelta(new Date().getTime()))
+        list["updatedBy"] = entry(audit.executor.id, renderUser(audit.executor))
+        let data = {
+            meta: {
+                type: 'channelUpdate',
+                displayName: 'Thread Edited',
+                calculateType: 'channelUpdate',
+                color: NucleusColors.yellow,
+                emoji: "CHANNEL.TEXT.EDIT",
+                timestamp: new Date().getTime()
+            },
+            list: list,
+            hidden: {
+                guild: after.guild.id
+            }
+        }
+        log(data, after.client);
+    } catch {}
+}
