From 4ce5bdc805ffc1f7a06c93c8342cc2e2b15cb90f Mon Sep 17 00:00:00 2001 From: yuki Date: Wed, 8 Oct 2025 23:00:06 -0300 Subject: [PATCH] create artist collages --- commands/collage.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/commands/collage.py b/commands/collage.py index 60e6618..239f9c6 100644 --- a/commands/collage.py +++ b/commands/collage.py @@ -12,7 +12,7 @@ async def create_chart(ctx: nerimity.Context, entity: str, size: str = "3x3", ti temp_msg = None if 'x' not in size: - await ctx.send(u.error_msg("Please provide a valid size.\nie `/chartalbum 5x5`")) + await ctx.send(u.error_msg(f"Please provide a valid size.\nie `/chart{entity} 5x5`")) return if int(size.split('x')[0]) > 5 or int(size.split('x')[1]) > 5: @@ -56,7 +56,7 @@ async def create_chart(ctx: nerimity.Context, entity: str, size: str = "3x3", ti return try: - temp_msg = await ctx.send(f"Generating album chart for **{username}**...") + temp_msg = await ctx.send(f"Generating {entity} chart for **{username}**...") image = bot.collage_generator.generate( entity = entity, @@ -81,9 +81,9 @@ async def create_chart(ctx: nerimity.Context, entity: str, size: str = "3x3", ti # bytes_arr = img_bytes, # ).upload() - link = await bot.zxz.upload_from_bytes(img_bytes.getvalue(), "chart.png") + link = await bot.zxz.upload_from_bytes(img_bytes.getvalue(), f"{entity}_chart.png") - await ctx.send(u.good_msg(f"**{size}** {timeframe} chart for [{username}](https://last.fm/user/{username}) successfully generated:\n{link}")) + await ctx.send(u.good_msg(f"**{size}** {timeframe} {entity} chart for [{username}](https://last.fm/user/{username}) successfully generated:\n{link}")) except Exception as e: print(e) @@ -103,3 +103,14 @@ def setup(bot: bot.Bot): timeframe = timeframe, username = username ) + + @bot.command(name="artistchart", aliases=["ac", "ca", "chartarist", "artistcollage"]) + @bot.slash_command(name="chartarist", description="Generate an artist collage.") + async def chartartist(ctx: nerimity.Context, size: str = "3x3", timeframe: str = "7day", username: str = None): + await create_chart( + ctx = ctx, + entity = "artist", + size = size, + timeframe = timeframe, + username = username + )