Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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)
 
PREVIOUS NEXT
Tagged: #print #audit #logs
ADD COMMENT
Topic
Name
1+5 =