Skip to content

Commit

Permalink
Use permacache url to display attachments and avatars
Browse files Browse the repository at this point in the history
  • Loading branch information
Erisa committed Aug 3, 2024
1 parent 523cc37 commit df92f9f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

from core.formatter import format_content_html

import os


class LogEntry:
def __init__(self, app, data):
Expand Down Expand Up @@ -116,7 +118,7 @@ def __init__(self, data):
self.id = int(data.get("id"))
self.name = data["name"]
self.discriminator = data["discriminator"]
self.avatar_url = data["avatar_url"]
self.avatar_url = data["avatar_url"].replace('cdn.discordapp.com/', os.environ['PERMACACHE_LOCATION'])
self.mod = data["mod"]

@property
Expand Down Expand Up @@ -157,7 +159,7 @@ def __init__(self, data):
else:
self.id = int(data["id"])
self.filename = data["filename"]
self.url = data["url"]
self.url = data["url"].replace('cdn.discordapp.com/', os.environ['PERMACACHE_LOCATION'])
self.is_image = data["is_image"]
self.size = data["size"]

Expand Down

0 comments on commit df92f9f

Please sign in to comment.