How can I know who triggers on_member_update? #6182
-
In my server everyone can change other people's nicknames. I tried looking on the intenet but didn't find anything helpful :( |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
You can iterate through your server's audit log Basically, since @commands.Cog.listener()
async def on_member_update(self, before, after):
async for entry in after.guild.audit_logs(limit=10):
print('{0.user} did {0.action} to {0.target}'.format(entry)) I don't know if this is the best way to do that, but it works. Another way is to get the guild from a specific ID: @commands.Cog.listener()
async def on_member_update(self, before, after):
guild = self.bot.get_guild(123456789)
async for entry in guild.audit_logs(limit=10):
print('{0.user} did {0.action} to {0.target}'.format(entry)) Check out these references for more information: |
Beta Was this translation helpful? Give feedback.
You can iterate through your server's audit log
Basically, since
before
andafter
areMember
objects, you can get the guild from them:I don't know if this is the best way to do that, but it works. Another way is to get the guild from a specific ID:
Check out these refer…