aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/cogs/moderation/modlog.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/bot/cogs/moderation/modlog.py b/bot/cogs/moderation/modlog.py
index 6d4b66644..3c6731de6 100644
--- a/bot/cogs/moderation/modlog.py
+++ b/bot/cogs/moderation/modlog.py
@@ -127,10 +127,10 @@ class ModLog(Cog, name="ModLog"):
channel = self.bot.get_channel(channel_id)
out = []
for attachment in message.attachments:
- buffer = BytesIO()
- await attachment.save(buffer, use_cached=True)
- reupload = await channel.send(file=discord.File(buffer, filename=attachment.filename))
- out.append(reupload.attachments[0].url)
+ with BytesIO() as buffer:
+ await attachment.save(buffer, use_cached=True)
+ reupload: discord.Message = await channel.send(file=discord.File(buffer, filename=attachment.filename))
+ out.append(reupload.attachments[0].url)
return out
@Cog.listener()