All commands and some events finished
diff --git a/src/events/guildBanAdd.ts b/src/events/guildBanAdd.ts
index 5fd0b49..3d96245 100644
--- a/src/events/guildBanAdd.ts
+++ b/src/events/guildBanAdd.ts
@@ -1,4 +1,5 @@
-import type { GuildAuditLogsEntry, GuildBan } from "discord.js";
+import type { GuildAuditLogsEntry, GuildBan, User } from "discord.js";
+import { AuditLogEvent } from 'discord.js';
import { purgeByUser } from "../actions/tickets/delete.js";
import { callback as statsChannelRemove } from "../reflex/statsChannelUpdate.js";
import type { NucleusClient } from "../utils/client.js";
@@ -7,12 +8,13 @@
export async function callback(client: NucleusClient, ban: GuildBan) {
await statsChannelRemove(client, undefined, ban.guild, ban.user);
- purgeByUser(ban.user.id, ban.guild);
+ purgeByUser(ban.user.id, ban.guild.id);
const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } = client.logger;
- const auditLog = await getAuditLog(ban.guild, "MEMBER_BAN_ADD");
- const audit = auditLog.entries.filter((entry: GuildAuditLogsEntry) => entry.target!.id === ban.user.id).first();
- if (audit.executor.id === client.user.id) return;
- await client.database.history.create("ban", ban.guild.id, ban.user, audit.executor, audit.reason);
+ const auditLog: GuildAuditLogsEntry | undefined = (await getAuditLog(ban.guild, AuditLogEvent.EmojiCreate))
+ .filter((entry: GuildAuditLogsEntry) => ((entry.target! as User).id === ban.user.id))[0];
+ if (!auditLog) return;
+ if (auditLog.executor!.id === client.user!.id) return;
+ await client.database.history.create("ban", ban.guild.id, ban.user, auditLog.executor, auditLog.reason);
const data = {
meta: {
type: "memberBan",
@@ -26,9 +28,9 @@
memberId: 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)),
+ bannedBy: entry(auditLog.executor!.id, renderUser(auditLog.executor!)),
+ reason: entry(auditLog.reason, auditLog.reason ? `\n> ${auditLog.reason}` : "*No reason provided.*"),
+ accountCreated: entry(ban.user.createdTimestamp, renderDelta(ban.user.createdTimestamp)),
serverMemberCount: ban.guild.memberCount
},
hidden: {