#```js
1 messages · Page 1 of 1 (latest)
client.on("guildMemberAdd", async (member) => {
const auditLogs = await member.guild.fetchAuditLogs({
type: AuditLogEvent.BotAdd,
limit: 1,
});
const logs = await auditLogs.entries.first();
if (!logs) {
console.log("No audit log entry found for BotAdd event.");
return;
}
const { executor, target } = logs;
......
});