Skip to content

Commit

Permalink
Ensure permacache only happens for mod messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Erisa committed Aug 3, 2024
1 parent 6df205a commit f18d4bc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,12 +666,15 @@ async def append_log(
message_id = str(message_id) or str(message.id)

member = self.bot.guild.get_member(message.author.id)

ismod = not isinstance(message.channel, DMChannel)

if member:
avatar_url = member.display_avatar.url
else:
avatar_url = message.author.display_avatar.url

if "PERMACACHE_LOCATION" in os.environ:
if "PERMACACHE_LOCATION" in os.environ and ismod:
for a in message.attachments:
task = asyncio.create_task(
self.warm_permacache(
Expand All @@ -689,7 +692,7 @@ async def append_log(
"name": message.author.name,
"discriminator": message.author.discriminator,
"avatar_url": avatar_url,
"mod": not isinstance(message.channel, DMChannel),
"mod": ismod,
},
"content": message.content,
"type": type_,
Expand Down

0 comments on commit f18d4bc

Please sign in to comment.