Skip to content

Commit

Permalink
fix: Fix static image not found in /notes
Browse files Browse the repository at this point in the history
  • Loading branch information
seriaati committed Mar 5, 2024
1 parent 47d1288 commit 760ec03
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/cogs/hoyo.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from ..db.models import EnkaCache, HoyoAccount, Settings
from ..draw.hoyo.genshin.notes import draw_genshin_notes_card
from ..draw.hoyo.hsr.notes import draw_hsr_notes_card
from ..draw.static import download_and_save_static_images
from ..emojis import PROJECT_AMBER
from ..enums import Game
from ..exceptions import IncompleteParamError, InvalidQueryError, NoAccountFoundError
Expand Down Expand Up @@ -644,6 +645,9 @@ async def notes_command(

if account.game is Game.GENSHIN:
notes = await client.get_genshin_notes()
await download_and_save_static_images(
[exped.character_icon for exped in notes.expeditions], "gi-notes", self.bot.session
)
buffer = await asyncio.to_thread(
draw_genshin_notes_card,
notes,
Expand All @@ -653,6 +657,9 @@ async def notes_command(
)
elif account.game is Game.STARRAIL:
notes = await client.get_starrail_notes()
await download_and_save_static_images(
[exped.item_url for exped in notes.expeditions], "hsr-notes", self.bot.session
)
buffer = await asyncio.to_thread(
draw_hsr_notes_card,
notes,
Expand Down
2 changes: 1 addition & 1 deletion src/draw/hoyo/genshin/notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def draw_genshin_notes_card(
filename = f"{'dark' if dark_mode else 'light'}-gi"
im = Image.open(f"hoyo-buddy-assets/assets/notes/{filename}.png")
draw = ImageDraw.Draw(im)
drawer = Drawer(draw, folder="notes", dark_mode=dark_mode, translator=translator)
drawer = Drawer(draw, folder="gi-notes", dark_mode=dark_mode, translator=translator)

drawer.write(
LocaleStr("Real-Time Notes", key="notes-card.gi.realtime-notes"),
Expand Down
2 changes: 1 addition & 1 deletion src/draw/hoyo/hsr/notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def draw_hsr_notes_card(
filename = f"{'dark' if dark_mode else 'light'}-hsr"
im = Image.open(f"hoyo-buddy-assets/assets/notes/{filename}.png")
draw = ImageDraw.Draw(im)
drawer = Drawer(draw, folder="notes", dark_mode=dark_mode, translator=translator)
drawer = Drawer(draw, folder="hsr-notes", dark_mode=dark_mode, translator=translator)

drawer.write(
LocaleStr("Real-Time Notes", key="notes-card.gi.realtime-notes"),
Expand Down

0 comments on commit 760ec03

Please sign in to comment.