pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame^] | 1 | import log from '../utils/log.js' |
| 2 | |
| 3 | export const name = 'guildBanAdd' |
| 4 | export const once = false |
| 5 | export 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 | } |