Ejemplo n.º 1
0
 async def dag_discord(self,
                       ctx,
                       user: discord.User = None,
                       *,
                       text: str = None):
     """
     Makes it look like someone said something.
     """
     user_name = None
     if text is None:
         url = str(
             ctx.author.avatar.replace(format="png",
                                       static_format="png",
                                       size=1024))
         text = "I am an idiot for not putting the text in"
         user_name = ctx.author.name
     else:
         url = str(
             user.avatar.replace(format="png",
                                 static_format="png",
                                 size=1024))
     async with ctx.channel.typing():
         image = await self.bot.dagpi.image_process(
             ImageFeatures.discord(),
             text=text,
             url=url,
             username=user.name if user_name is None else user_name,
         )
     await self.dag_embed(ctx, image, ctx.command.name)
Ejemplo n.º 2
0
async def test_parameter_error():
    tok = os.getenv("DAGPI_TOKEN")
    c = Client(tok)
    try:
        await c.image_process(ImageFeatures.discord(),
                              "https://dagpi.xyz/dagpi.png")
    except Exception as e:
        assert isinstance(e, errors.ParameterError)
    await c.close()
Ejemplo n.º 3
0
 async def message(self, ctx, user: BetterMemberConverter = None, *, text):
     if user is None:
         user = ctx.author
     uname = user.display_name
     text = str(text)
     pfp = str(user.avatar_url_as(format="png", size=1024))
     img = await self.client.dagpi.image_process(ImageFeatures.discord(),
                                                 url=pfp,
                                                 username=uname,
                                                 text=text)
     await self.to_embed(ctx, img, "message")
Ejemplo n.º 4
0
 async def discord(self, ctx, member: discord.Member = None, *, text):
     await ctx.trigger_typing()
     if member is None:
         member = ctx.author
     if text is None:
         text = 'Bitch WTF'
     name = member.display_name
     url = str(
         member.avatar_url_as(format="png", static_format="png", size=1024))
     img = await self.bot.dagp.image_process(ImageFeatures.discord(),
                                             url,
                                             text=text,
                                             username=name)
     await ctx.send(
         file=discord.File(fp=img.image, filename=f"pixel.{img.format}"))
Ejemplo n.º 5
0
    async def message(self, ctx, member: discord.Member = None, *, text):
        if member is None:
            member = ctx.author

        uname = member.display_name
        text = str(text)
        pfp = str(member.avatar_url_as(format="png", size=1024))
        img = await self.bot.dagpi.image_process(ImageFeatures.discord(),
                                                 url=pfp,
                                                 username=uname,
                                                 text=text)
        e2file = discord.File(fp=img.image, filename=f"message.{img.format}")
        e = discord.Embed(title="Here You Go! Message Sent!")
        e.set_image(url=f"attachment://message.{img.format}")
        await ctx.send(file=e2file, embed=e)
Ejemplo n.º 6
0
    async def message(self, ctx, member: Optional[Union[discord.Member,
                                                        MemberID]], *, text):
        """Send a fake Discord message"""
        member = member or ctx.author

        uname = member.display_name
        text = str(text)
        pfp = str(member.display_avatar.url)
        img = await self.dagpi.image_process(ImageFeatures.discord(),
                                             url=pfp,
                                             username=uname,
                                             text=text)
        e2file = discord.File(fp=img.image, filename=f"message.{img.format}")
        e = Embed(title="Here You Go! Message Sent!")
        e.set_image(url=f"attachment://message.{img.format}")
        await ctx.send(file=e2file, embed=e)
Ejemplo n.º 7
0
async def test_image_kwargs():
    tok = os.getenv("DAGPI_TOKEN")
    c = Client(tok)
    discord = await c.image_process(ImageFeatures.discord(), "https://dagbot-is.the-be.st/logo.png", text="Message", username="******", dark=False)
    await c.close()