Skip to content

Commit

Permalink
Fixed url schema error
Browse files Browse the repository at this point in the history
  • Loading branch information
MujyKun committed Aug 16, 2021
1 parent 5ab31ab commit 6d17f28
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
21 changes: 13 additions & 8 deletions IreneUtility/models/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,23 @@ async def send_images_to_host(self):
file_loc = f"{base_util.ex.keys.idol_avatar_location}{file_name}"
if 'images.irenebot.com' not in self.thumbnail:
await base_util.ex.download_image(self.thumbnail, file_loc)
image_url = f"https://images.irenebot.com/avatar/{file_name}"
if base_util.ex.check_file_exists(file_loc):
await base_util.ex.sql.s_groupmembers.set_group_thumbnail(self.id, image_url)
self.thumbnail = image_url
image_url = f"https://images.irenebot.com/avatar/{file_name}"
if base_util.ex.check_file_exists(file_loc):
await base_util.ex.sql.s_groupmembers.set_group_thumbnail(self.id, image_url)
self.thumbnail = image_url
self.thumbnail.replace("https://", "")
self.thumbnail = "https://" + self.thumbnail.replace("//", "/")

if self.banner:
file_loc = f"{base_util.ex.keys.idol_banner_location}{file_name}"
if 'images.irenebot.com' not in self.banner:
await base_util.ex.download_image(self.banner, file_loc)
image_url = f"https://images.irenebot.com/banner/{file_name}"
if base_util.ex.check_file_exists(file_loc):
await base_util.ex.sql.s_groupmembers.set_group_banner(self.id, image_url)
self.banner = image_url
image_url = f"https://images.irenebot.com/banner/{file_name}"
if base_util.ex.check_file_exists(file_loc):
await base_util.ex.sql.s_groupmembers.set_group_banner(self.id, image_url)
self.banner = image_url
self.banner.replace("https://", "")
self.banner = "https://" + self.banner.replace("//", "/")

def set_attribute(self, column, content):
"""Sets the attribute for a column in the DB.
Expand Down
6 changes: 4 additions & 2 deletions IreneUtility/models/idol.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ async def send_images_to_host(self):
image_url = f"{base_util.ex.keys.image_host}avatar/{file_name}"
await base_util.ex.sql.s_groupmembers.set_member_thumbnail(self.id, image_url)
self.thumbnail = image_url
self.thumbnail = self.thumbnail.replace("//", "/")
self.thumbnail.replace("https://", "")
self.thumbnail = "https://" + self.thumbnail.replace("//", "/")

if self.banner:
file_loc = f"{base_util.ex.keys.idol_banner_location}{file_name}"
Expand All @@ -66,7 +67,8 @@ async def send_images_to_host(self):
if base_util.ex.check_file_exists(file_loc):
await base_util.ex.sql.s_groupmembers.set_member_banner(self.id, image_url)
self.banner = image_url
self.banner = self.banner.replace("//", "/")
self.banner.replace("https://", "")
self.banner = "https://" + self.banner.replace("//", "/")

def set_attribute(self, column, content):
"""Sets the attribute for a column in the DB.
Expand Down

0 comments on commit 6d17f28

Please sign in to comment.