restructure collage generation
This commit is contained in:
parent
f9dc2e5b94
commit
d130a1a3c5
1 changed files with 72 additions and 63 deletions
|
|
@ -8,10 +8,7 @@ import utils as u
|
||||||
# from catbox_async_uploader.catbox_async_uploader.enums import LitterboxDuration
|
# from catbox_async_uploader.catbox_async_uploader.enums import LitterboxDuration
|
||||||
# from pyzxz import ZeroXZero
|
# from pyzxz import ZeroXZero
|
||||||
|
|
||||||
def setup(bot: bot.Bot):
|
async def create_chart(ctx: nerimity.Context, entity: str, size: str = "3x3", timeframe: str = "7day", username: str = None):
|
||||||
@bot.command(name="chart", aliases=["c", "chartalbum", "albumchart", "collage"])
|
|
||||||
@bot.slash_command(name="chartalbum", description="Generate an album collage.")
|
|
||||||
async def chartalbum(ctx: nerimity.Context, size: str = "3x3", timeframe: str = "7day", username: str = None):
|
|
||||||
temp_msg = None
|
temp_msg = None
|
||||||
|
|
||||||
if 'x' not in size:
|
if 'x' not in size:
|
||||||
|
|
@ -62,7 +59,7 @@ def setup(bot: bot.Bot):
|
||||||
temp_msg = await ctx.send(f"Generating album chart for **{username}**...")
|
temp_msg = await ctx.send(f"Generating album chart for **{username}**...")
|
||||||
|
|
||||||
image = bot.collage_generator.generate(
|
image = bot.collage_generator.generate(
|
||||||
entity = "album",
|
entity = entity,
|
||||||
username = username,
|
username = username,
|
||||||
rows = int(size.split(sep="x")[0]),
|
rows = int(size.split(sep="x")[0]),
|
||||||
cols = int(size.split(sep="x")[1]),
|
cols = int(size.split(sep="x")[1]),
|
||||||
|
|
@ -94,3 +91,15 @@ def setup(bot: bot.Bot):
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
if temp_msg: temp_msg.delete()
|
if temp_msg: temp_msg.delete()
|
||||||
|
|
||||||
|
def setup(bot: bot.Bot):
|
||||||
|
@bot.command(name="chart", aliases=["c", "chartalbum", "albumchart", "collage"])
|
||||||
|
@bot.slash_command(name="chartalbum", description="Generate an album collage.")
|
||||||
|
async def chartalbum(ctx: nerimity.Context, size: str = "3x3", timeframe: str = "7day", username: str = None):
|
||||||
|
await create_chart(
|
||||||
|
ctx = ctx,
|
||||||
|
entity = "album",
|
||||||
|
size = size,
|
||||||
|
timeframe = timeframe,
|
||||||
|
username = username
|
||||||
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue