示例#1
0
 async def haah(self, ctx, *, url: typing.Optional[str] = None):
     if (url is None):
         image = await get_image(ctx.message)
         if isinstance(image, Error_image):
             await ctx.send(image.get_message())
         else:
             img = func_haah(image)
             file = discord.File(fp=img, filename='haah.png')
             await ctx.send(file=file)
     else:
         urls = url.split()
         if len(urls) < 4:
             files = list()
             error_message = ''
             cont = 1
             for u in urls:
                 if verifica_url(u) == True:
                     image = download_image(u)
                     if isinstance(image, Error_image):
                         error_message += f'{image.get_message()} {cont}\n'
                     else:
                         img = func_haah(image)
                         file = discord.File(fp=img,
                                             filename=f'haah{cont}.png')
                         files.append(file)
                     cont += 1
             if (len(files) == 1):
                 await ctx.send(error_message, file=files[0])
             elif (len(files) == 0):
                 await ctx.send(error_message)
             else:
                 await ctx.send(error_message, files=files)
         else:
             await ctx.send('Muitas imagens o máximo são 3.')
示例#2
0
 async def flop(self, ctx, url: typing.Optional[str] = None):
     if (url is None):
         image = await get_image(ctx.message)
         if isinstance(image, Error_image):
             await ctx.send(image.get_message())
         else:
             img = func_flop(image)
             file = discord.File(fp=img, filename='spin.gif')
             await ctx.send(file=file)
     else:
         if verifica_url(url) == True:
             image = download_image(url)
             if isinstance(image, Error_image):
                 await ctx.send(image.get_message())
             else:
                 img = func_flop(image)
                 file = discord.File(fp=img, filename=f'spin.gif')
                 await ctx.send(file=file)
         else:
             await ctx.send('Erro, url inválida.')
示例#3
0
 async def burn(self, ctx, url: typing.Optional[str] = None):
     if (url is None):
         image = await get_image(ctx.message)
         if isinstance(image, Error_image):
             await ctx.send(image.get_message())
         else:
             img = func_burn(image)
             embed = discord.Embed()
             embed.set_image(url=img)
             await ctx.send(embed=embed)
     else:
         if verifica_url(url) == True:
             image = download_image(url)
             if isinstance(image, Error_image):
                 await ctx.send(image.get_message())
             else:
                 img = func_burn(image)
                 embed = discord.Embed()
                 embed.set_image(url=img)
                 await ctx.send(embed=embed)
         else:
             await ctx.send('Erro, url inválida.')