From 956afa5a08dd4da430adff1b1b3d6ae42bbaf5c7 Mon Sep 17 00:00:00 2001 From: ddorn Date: Mon, 11 May 2020 23:26:11 +0200 Subject: [PATCH] :sparkles: fractals can be seeded --- src/cogs/misc.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/cogs/misc.py b/src/cogs/misc.py index 0f89516..e9e9ce2 100644 --- a/src/cogs/misc.py +++ b/src/cogs/misc.py @@ -101,14 +101,17 @@ class MiscCog(Cog, name="Divers"): @command(hidden=True) async def fractal(self, ctx: Context): await ctx.message.add_reaction(Emoji.CHECK) - - seed = random.randint(0, 1_000_000_000) + msg: discord.Message = ctx.message + seed = msg.content[len("!fractal ") :] + seed = seed or random.randint(0, 1_000_000_000) async with aiohttp.ClientSession() as session: async with session.get(FRACTAL_URL.format(seed=seed)) as resp: if resp.status != 200: return await ctx.send("Could not download file...") data = io.BytesIO(await resp.read()) - await ctx.send(file=discord.File(data, "cool_image.png")) + await ctx.send( + f"Seed: {seed}", file=discord.File(data, "cool_image.png") + ) @command(hidden=True, aliases=["bang", "pan"]) async def pew(self, ctx):