[英]How would I get the number of bans a person has done?
I'm looking for a way to get the number of bans a moderator has done, here is what I have so far.我正在寻找一种方法来获取版主已完成的禁令数量,这是我到目前为止所拥有的。 I'm guessing I have to loop thru each ban?
我猜我必须循环通过每个禁令?
let targetMod = message.mentions.users.first()
message.guild.bans.fetch().then((bans) => {
bans.forEach((ban) => {
//My problem is here, I dont know how to check who did the ban
})
})
The moderator is not actually provided in the info.主持人实际上并未在信息中提供。 You will need to check the audit logs for this (will only go back to a certain time, it's not fully accurate)
您需要为此检查审核日志(仅 go 回到某个时间,它并不完全准确)
let logs = await message.guild.fetchAuditLogs()
logs = logs.entries.filter(e => e.action === "MEMBER_BAN_ADD")
logs = logs.entries.filter(e => e.executor.id === targetMod.id)
console.log(logs.size) //should be the rough amount of bans
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.