예제 #1
0
    async def modernmeme(self, ctx):
        await ctx.trigger_typing()
        await ctx.send(
            "Lets begin. Please send an image. It can be a url or an "
            "attachment or a mention of a member!")

        def check(message):
            return (message.author == ctx.author
                    and message.channel == ctx.channel
                    and not message.author.bot)

        try:
            msg = await self.client.wait_for("message",
                                             timeout=60.0,
                                             check=check)
        except asyncio.TimeoutError:
            return await ctx.reply(
                "No Image was provided, If you want me to make your meme at "
                "least give me something to work with")
        else:
            try:
                cont = msg.content
                member = await BetterMemberConverter().convert(ctx, cont)
                image_url = member.avatar_url(static_format='png', size='1024')
            except BaseException:
                pass
            if len(msg.attachments) != 0:
                try:
                    image_url = msg.attachments[0].url

                except BaseException:
                    return await msg.reply(
                        "I was unable to use the attachment you provided")
            elif len(msg.mentions) != 0:
                image_url = str(msg.mentions[0].avatar_url_as(format='png',
                                                              size=1024))
            else:
                source = msg.content
                val_stat = await UrlValidator().validate(source)
                if val_stat:
                    image_url = str(source)
                else:
                    return await msg.reply('The URL provided was invalid.')
            await msg.reply(
                "Great, now hit me we with the \
        puncline/top text/joke for the "
                "meme. Please note whatever message you send is the content.")
            try:
                tm = await self.client.wait_for("message",
                                                timeout=60.0,
                                                check=check)
            except asyncio.TimeoutError:
                return await msg.reply(
                    "No top text was provided, If you want me to make your "
                    "meme at least give me something to work with")
            else:
                toptext = tm.content
                img = await self.client.dagpi.image_process(
                    ImageFeatures.modern_meme(), url=image_url, text=toptext)
                await self.client.get_cog("image").to_embed(ctx, img, "Meme")
예제 #2
0
 async def wtf(self, ctx, member: discord.Member = None, *, text1=None):
     await ctx.trigger_typing()
     if member is None:
         member = ctx.author
     if text1 is None:
         text1 = 'Where would you feel the pain if your leg got cut off'
     url = str(
         member.avatar_url_as(format="png", static_format="png", size=1024))
     img = await self.bot.dagp.image_process(ImageFeatures.modern_meme(),
                                             url,
                                             text=text1)
     await ctx.send(
         file=discord.File(fp=img.image, filename=f"pixel.{img.format}"))