Ejemplo n.º 1
0
    async def supreme(self, ctx, *, text: commands.clean_content(fix_channel_mentions=True)):
        """ Make a fake Supreme logo

        Arguments:
            --dark | Make the background to dark colour
            --light | Make background to light and text to dark colour
        """
        parser = argparser.Arguments()
        parser.add_argument('input', nargs="+", default=None)
        parser.add_argument('-d', '--dark', action='store_true')
        parser.add_argument('-l', '--light', action='store_true')

        args, valid_check = parser.parse_args(text)
        if not valid_check:
            return await ctx.send(args)

        inputText = urllib.parse.quote(' '.join(args.input))
        if len(inputText) > 500:
            return await ctx.send(f"**{ctx.author.name}**, the Supreme API is limited to 500 characters, sorry.")

        darkorlight = ""
        if args.dark:
            darkorlight = "dark=true"
        if args.light:
            darkorlight = "light=true"
        if args.dark and args.light:
            return await ctx.send(f"**{ctx.author.name}**, you can't define both --dark and --light, sorry..")

        await self.api_img_creator(ctx, f"https://api.alexflipnote.dev/supreme?text={inputText}&{darkorlight}", "supreme.png", token=self.alex_api_token)
Ejemplo n.º 2
0
    async def supreme(self, ctx, *, text: str):
        """ Make a fake Supreme logo
        Arguments:
            --dark | Make the background to dark colour
            --light | Make background to light and text to dark colour
        """
        async with ctx.typing():
            parser = argparser.Arguments()
            parser.add_argument('input', nargs="+", default=None)
            parser.add_argument('-d', '--dark', action='store_true')
            parser.add_argument('-l', '--light', action='store_true')

            args, valid_check = parser.parse_args(text)
            if not valid_check:
                return await ctx.send(args)

            inputText = ' '.join(args.input)
            if len(inputText) > 500:
                return await ctx.send(
                    f"**{ctx.author.name}**, the Supreme API is limited to 500 characters, sorry."
                )

            dark = None
            light = None

            if args.dark:
                dark = True
                light = None
            if args.light:
                dark = None
                light = True
            if args.dark and args.light:
                return await qembed.send(
                    ctx,
                    f"**{ctx.author.name}**, you can't define both --dark and --light, sorry.."
                )

            image = await self.bot.alex.supreme(text=inputText,
                                                dark=dark,
                                                light=light)
            image_bytes = await image.read()
            file = discord.File(image_bytes, "supreme.png")
            embed = discord.Embed(colour=self.bot.embed_color,
                                  timestamp=ctx.message.created_at)
            embed.set_author(name=ctx.author, icon_url=ctx.author.avatar_url)
            embed.set_image(url="attachment://supreme.png")
            embed.set_footer(text="Powered by the AlexFlipnote API")
            await ctx.send(embed=embed, file=file)