如何从discord.py中的用户的审核日志中获取所有昵称?

时间:2020-06-29 13:13:47

标签: python-3.x discord discord.py discord.py-rewrite

我想从Discord.py重写版本的列表中的审核日志中获取所有昵称

1 个答案:

答案 0 :(得分:0)

StackOverflow不是代码编写服务。我可以为您指明正确的方向。您必须编写自己的实际代码。
当您陷入困境时,请提出一个具体问题。

您需要遍历audit_logs,请参阅:https://discordpy.readthedocs.io/en/latest/api.html?highlight=audit%20log#discord.Guild.audit_logs

要获取昵称更改的审核事件,您需要为action过滤discord.AuditLogAction.member_update,请参阅:https://discordpy.readthedocs.io/en/latest/api.html?highlight=audit%20log#discord.AuditLogAction.member_update

AuditLogEntry具有一个beforeafter,请参阅:https://discordpy.readthedocs.io/en/latest/api.html?highlight=audit%20log#discord.AuditLogEntry.before
这些是AuditLogDiff的实例,您可以访问其昵称,请参阅:https://discordpy.readthedocs.io/en/latest/api.html?highlight=audit%20log#discord.AuditLogDiff.nick