fixed leave
diff --git a/src/automations/statsChannelRemove.ts b/src/automations/statsChannelRemove.ts
index da4f43b..c6d4e65 100644
--- a/src/automations/statsChannelRemove.ts
+++ b/src/automations/statsChannelRemove.ts
@@ -10,9 +10,10 @@
let string = element.text
if (!string) return
string = await convertCurlyBracketString(string, member.id, member.displayName, member.guild.name, member.guild.members)
-
- let channel = await member.client.channels.fetch(element.channel)
- if (channel.guild.id !== member.guild.id) return
+ let channel;
+ try {
+ channel = await member.client.channels.fetch(element.channel)
+ } catch { channel = null }
if (!channel) return singleNotify(
"statsChannelDeleted",
member.guild.id,
diff --git a/src/events/memberLeave.ts b/src/events/memberLeave.ts
index 50901dc..43e78bd 100644
--- a/src/events/memberLeave.ts
+++ b/src/events/memberLeave.ts
@@ -11,11 +11,12 @@
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"
+ let type = "leave"
if (audit) {
- if (audit.createdAt - 100 < new Date().getTime()) {
- type = "leave"
- } else if (audit.executor.id == client.user.id) return
+ if (audit.executor.id === client.user.id) return
+ if (audit.createdAt - 100 >= new Date().getTime()) {
+ type = "kick"
+ }
}
let data
if (type == "kick") {
@@ -70,5 +71,5 @@
}
}
log(data);
- } catch {}
+ } catch (e) { console.log(e) }
}