async def swirl_error(self, ctx, error): if isinstance(error, commands.CommandOnCooldown): errembed = discord.Embed( title='Hold on there, buddy', color=err_color, description= 'Wait 3 more seconds before you can get another snap!') await ctx.send(embed=errembed) elif isinstance(error, commands.MissingRequiredArgument): async with self.ses.get(str(ctx.author.avatar_url)) as r: img = Image.open(BytesIO(await r.read()), mode='r') try: img.seek(1) url = str(ctx.author.avatar_url_as(format=f'gif')) except EOFError: url = str(ctx.author.avatar_url_as(format=f'png')) try: img = await self.dagpi.image_process( ImageFeatures.swirl(), url) mbed = discord.Embed(title='Snap!', color=color) mbed.set_image(url=f"attachment://swirled.{img.format}") mbed.set_footer(text=f'Swirl | Requested by {ctx.author}') file = discord.File(fp=img.image, filename=f"swirled.{img.format}") await ctx.send(embed=mbed, file=file) except: await ctx.send(embed=discord.Embed( description= f'<:error:806618798768652318> Error when making request. | Image may be a WEBP file', color=color))
async def swirl(self, ctx, member: discord.Member = None): await ctx.trigger_typing() if member is None: member = ctx.author url = str( member.avatar_url_as(format="png", static_format="png", size=1024)) img = await self.bot.dagp.image_process(ImageFeatures.swirl(), url) await ctx.send( file=discord.File(fp=img.image, filename=f"pixel.{img.format}"))
async def swirl(self, ctx, url: str): try: img = await self.dagpi.image_process(ImageFeatures.swirl(), url) mbed = discord.Embed(title='Snap!', color=color) mbed.set_image(url=f"attachment://swirled.{img.format}") mbed.set_footer(text=f'Swirl | Requested by {ctx.author}') file = discord.File(fp=img.image, filename=f"swirled.{img.format}") await ctx.send(embed=mbed, file=file) except: await ctx.send(embed=discord.Embed( description= f'<:error:806618798768652318> Error when making request. | Image may be a WEBP file', color=color))
async def dag_swirl(self, ctx: Context, *, item=None): """ Swirls your image. """ meth = await self.do_dagpi(ctx, ImageFeatures.swirl(), item) await self.dag_embed(ctx, meth, ctx.command.name)