mirror of
https://github.com/neoarz/Syntrel.git
synced 2025-12-25 03:40:11 +01:00
chore: ruff formatting
This commit is contained in:
@@ -23,7 +23,7 @@ def archive_command():
|
||||
:param limit: The limit of messages that should be archived. Default is 10.
|
||||
"""
|
||||
log_file = f"{context.channel.id}.log"
|
||||
|
||||
|
||||
messages = []
|
||||
async for message in context.channel.history(
|
||||
limit=limit, before=context.message
|
||||
@@ -36,10 +36,10 @@ def archive_command():
|
||||
if len(attachments) >= 1
|
||||
else ""
|
||||
)
|
||||
|
||||
|
||||
message_line = f"{message.created_at.strftime('%m/%d/%Y %H:%M:%S')} {message.author} {message.id}: {message.clean_content} {attachments_text}\n"
|
||||
messages.append(message_line)
|
||||
|
||||
|
||||
with open(log_file, "w", encoding="UTF-8") as f:
|
||||
f.write(
|
||||
f'Archived messages from: #{context.channel} ({context.channel.id}) in the guild "{context.guild}" ({context.guild.id}) at {datetime.now().strftime("%m/%d/%Y %H:%M:%S")}\n'
|
||||
@@ -47,9 +47,9 @@ def archive_command():
|
||||
|
||||
for message_line in reversed(messages):
|
||||
f.write(message_line)
|
||||
|
||||
|
||||
f = discord.File(log_file)
|
||||
await context.send(file=f)
|
||||
os.remove(log_file)
|
||||
|
||||
return archive
|
||||
|
||||
return archive
|
||||
|
||||
Reference in New Issue
Block a user