blob: c165805568bd58f360b2620d7d9947afa433125f [file] [log] [blame]
pineafan32767212022-03-14 21:27:39 +00001import log from '../utils/log.js'
2
3export const name = 'guildBanAdd'
4export const once = false
5export async function execute(ban) {
6 let logs = await ban.guild.fetchAuditLogs({'type': 'MEMBER_BAN_CREATE'});
7 let log = logs.entries.find(log => log.target.id === ban.user.id)
8
9 let data = {
10 id: ban.user.id,
11 username: ban.user.username,
12 reason: ban.reason,
13 bannedAt: log.createdTimestamp,
14 bannedBy: log.executor.id
15 }
16
17 log(ban.guild.id, data);
18}