All commands and some events finished
diff --git a/src/events/guildBanRemove.ts b/src/events/guildBanRemove.ts
index f9b427a..bcb70d5 100644
--- a/src/events/guildBanRemove.ts
+++ b/src/events/guildBanRemove.ts
@@ -1,16 +1,18 @@
-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 type { NucleusClient } from "../utils/client.js";
export const event = "guildBanRemove";
export async function callback(client: NucleusClient, ban: GuildBan) {
- 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_REMOVE");
- 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("unban", ban.guild.id, ban.user, audit.executor, audit.reason);
+ const auditLog = (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("unban", ban.guild.id, ban.user, auditLog.executor, auditLog.reason);
const data = {
meta: {
type: "memberUnban",
@@ -24,8 +26,8 @@
memberId: 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))
+ unbannedBy: entry(auditLog.executor!.id, renderUser(auditLog.executor!)),
+ accountCreated: entry(ban.user.createdTimestamp, renderDelta(ban.user.createdTimestamp))
},
hidden: {
guild: ban.guild.id