create artist collages

This commit is contained in:
yuki 2025-10-08 23:00:06 -03:00
parent d130a1a3c5
commit 4ce5bdc805

View file

@ -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
)