create artist collages
This commit is contained in:
parent
d130a1a3c5
commit
4ce5bdc805
1 changed files with 15 additions and 4 deletions
|
|
@ -12,7 +12,7 @@ async def create_chart(ctx: nerimity.Context, entity: str, size: str = "3x3", ti
|
||||||
temp_msg = None
|
temp_msg = None
|
||||||
|
|
||||||
if 'x' not in size:
|
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
|
return
|
||||||
|
|
||||||
if int(size.split('x')[0]) > 5 or int(size.split('x')[1]) > 5:
|
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
|
return
|
||||||
|
|
||||||
try:
|
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(
|
image = bot.collage_generator.generate(
|
||||||
entity = entity,
|
entity = entity,
|
||||||
|
|
@ -81,9 +81,9 @@ async def create_chart(ctx: nerimity.Context, entity: str, size: str = "3x3", ti
|
||||||
# bytes_arr = img_bytes,
|
# bytes_arr = img_bytes,
|
||||||
# ).upload()
|
# ).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:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
|
@ -103,3 +103,14 @@ def setup(bot: bot.Bot):
|
||||||
timeframe = timeframe,
|
timeframe = timeframe,
|
||||||
username = username
|
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
|
||||||
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue