Answers for "discord.py how to print audit logs"

0

discord.py how to print audit logs

async def save_audit_logs(guild):
     with open(f'audit_logs_{guild.name}', 'w+') as f:
          async for entry in guild.audit_logs(limit=100):
               f.write('{0.user} did {0.action} to {0.target}'.format(entry))

@client.event
async def on_message(message):
     if message.content.startswith('audit'):
         await save_audit_logs(message.channel.guild)
Posted by: Guest on December-01-2020

Python Answers by Framework

Browse Popular Code Answers by Language