diff --git a/export_assets.py b/export_assets.py index 3244642..a727bd6 100644 --- a/export_assets.py +++ b/export_assets.py @@ -19,12 +19,16 @@ def main(): card_dir = target_dir / 'cards' card_icon_dir = card_dir / 'icons' card_art_dir = card_dir / 'art' + event_dir = target_dir / 'events' + event_logo_dir = event_dir / 'logos' music_dir.mkdir(exist_ok=True) chart_dir.mkdir(exist_ok=True) card_dir.mkdir(exist_ok=True) card_icon_dir.mkdir(exist_ok=True) card_art_dir.mkdir(exist_ok=True) + event_dir.mkdir(exist_ok=True) + event_logo_dir.mkdir(exist_ok=True) for music in asset_manager.music_master.values(): for chart in music.charts.values(): @@ -49,6 +53,15 @@ def main(): except FileNotFoundError: pass + for event in asset_manager.event_master.values(): + try: + event_hash = hash_master(event) + logo_path = event.logo_path + logo_target = event_logo_dir / f'{logo_path.stem}_{event_hash}{logo_path.suffix}' + shutil.copy(logo_path, logo_target) + except FileNotFoundError: + pass + if __name__ == '__main__': main() diff --git a/miyu_bot/commands/cogs/event.py b/miyu_bot/commands/cogs/event.py index 2ffd456..894b4a5 100644 --- a/miyu_bot/commands/cogs/event.py +++ b/miyu_bot/commands/cogs/event.py @@ -16,7 +16,7 @@ from miyu_bot.commands.common.emoji import attribute_emoji_ids_by_attribute_id, event_point_emoji_id from miyu_bot.commands.common.formatting import format_info from miyu_bot.commands.common.fuzzy_matching import romanize -from miyu_bot.commands.common.master_asset_manager import MasterFilter +from miyu_bot.commands.common.master_asset_manager import MasterFilter, hash_master from miyu_bot.commands.common.reaction_message import run_paged_message @@ -53,14 +53,11 @@ class Event(commands.Cog): return self.logger.info(f'Found event "{event}" ({romanize(event.name)}).') - try: - logo = discord.File(event.logo_path, filename='logo.png') - except FileNotFoundError: - # Just a fallback - logo = discord.File(asset_manager.path / 'ondemand/stamp/stamp_10006.png', filename='logo.png') - embed = discord.Embed(title=event.name) - embed.set_thumbnail(url=f'attachment://logo.png') + + event_hash = hash_master(event) + event_logo_path = event.logo_path + embed.set_thumbnail(url=f'https://qwewqa.github.io/d4dj-dumps/events/logos/{event_logo_path.stem}_{event_hash}{event_logo_path.suffix}') duration_hour_part = round((event.duration.seconds / 3600), 2) duration_hour_part = duration_hour_part if not duration_hour_part.is_integer() else int(duration_hour_part) @@ -109,7 +106,7 @@ class Event(commands.Cog): inline=True) embed.set_footer(text=f'Event Id: {event.id}') - await ctx.send(files=[logo], embed=embed) + await ctx.send(embed=embed) @commands.command(name='time', aliases=[],