Пример #1
0
    async def sep_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.sepia(), url)
                    mbed = discord.Embed(title='Snap!', color=color)
                    mbed.set_image(url=f"attachment://sepia.{img.format}")
                    mbed.set_footer(
                        text=f'Sepia Filter | Requested by {ctx.author}')
                    file = discord.File(fp=img.image,
                                        filename=f"sepia.{img.format}")
                    await ctx.send(embed=mbed, file=file)
                except:
                    await ctx.send(embed=discord.Embed(
                        description=
                        f'<:error:806618798768652318> Error when making request.',
                        color=color))
Пример #2
0
 async def sepai(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.sepia(), url)
     await ctx.send(
         file=discord.File(fp=img.image, filename=f"pixel.{img.format}"))
Пример #3
0
 async def sepia(self, ctx, url: str):
     try:
         img = await self.dagpi.image_process(ImageFeatures.sepia(), url)
         mbed = discord.Embed(title='Snap!', color=0xfffac4)
         mbed.set_image(url=f"attachment://sepia.{img.format}")
         mbed.set_footer(text=f'Sepia Filter | Requested by {ctx.author}')
         file = discord.File(fp=img.image, filename=f"sepia.{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))
Пример #4
0
 async def dag_sepia(self, ctx: Context, *, item=None):
     """
     Adds a sepia filter on to your photo.
     """
     meth = await self.do_dagpi(ctx, ImageFeatures.sepia(), item)
     await self.dag_embed(ctx, meth, ctx.command.name)