Exemplo n.º 1
0
    async def embed_file(self, ctx: NewCtx, message: str, fileout: BytesIO,
                         timediff: float, filename: str):
        fileout = File(fileout, filename)

        embed = BetterEmbed(title=message)
        embed.set_footer(text=f"That took {timediff:.2f}s")
        embed.set_image(url="attachment://" + filename)

        await ctx.send(embed=embed, file=fileout)
Exemplo n.º 2
0
    def format_page(self, menu, page: Rule34Post):

        embed = BetterEmbed(title=f'Results for : {self.query}',
                            url=page.file_url)
        fields = (
            ('Size', f'{page.width}x{page.height}'),
            ('Creator id', page.creator_ID),
            ('Created at',
             to_human_datetime(page.created_at, "%a %b %d %H:%M:%S %z %Y")),
        )
        embed.set_image(url=page.file_url)

        return embed.add_fields(fields)
Exemplo n.º 3
0
    def format_page(self, menu, page: Rule34Post):

        embed = BetterEmbed(title=f"Results for : {self.query}",
                            url=page.file_url)
        fields = (
            ("Size", f"{page.width}x{page.height}"),
            ("Creator id", page.creator_ID),
            (
                "Created at",
                to_human_datetime(page.created_at, "%a %b %d %H:%M:%S %z %Y"),
            ),
        )
        embed.set_image(url=page.file_url)

        return embed.add_fields(fields)
Exemplo n.º 4
0
Arquivo: r34.py Projeto: Zomatree/yert
    def format_page(self, menu, page: Rule34Post):
        embed = BetterEmbed(title=f'Results for : {self.query}',
                            url=page.file_url)

        created_at = datetime.strptime(
            page.created_at,
            "%a %b %d %H:%M:%S %z %Y")  # there must be a format for that

        fields = (
            ('Size', f'{page.width}x{page.height}'),
            ('Creator id', page.creator_ID),
            ('Created at', naturaldate(created_at)),
        )
        embed.set_image(url=page.file_url)

        return embed.add_fields(fields)
Exemplo n.º 5
0
 def format_page(self, menu, response: GoogleResponse):
     safesearch_state = 'OFF' if self.search_is_nsfw else 'ON'
     
     embed = BetterEmbed(title=f'{response.title} | Safesearch : {safesearch_state}',
                         description=response.description,
                         url=response.url)
     
     return embed.set_image(url=response.image_url)
Exemplo n.º 6
0
    def format_snapshot(self, *, response: MagmaChainResponse,
                        is_nsfw: bool) -> BetterEmbed:
        """Formats the snaphot into an embed"""
        embed = BetterEmbed(
            title=f"Screenshot | Safe : {'OFF' if is_nsfw else 'ON'}",
            url=response.website)

        embed.add_field(name='Link', value=maybe_url(response.website))

        return embed.set_image(url=response.snapshot)
Exemplo n.º 7
0
    def format_page(self, menu, response: GoogleResponse):
        safesearch_state = "OFF" if self.search_is_nsfw else "ON"

        embed = BetterEmbed(
            title=f"{response.title} | Safesearch : {safesearch_state}",
            description=response.description,
            url=response.url,
        )

        return embed.set_image(url=response.image_url)
Exemplo n.º 8
0
 def format_page(self, menu, page: Union[_nhentai.Doujinshi, str]):
     if isinstance(page, str):
         return page
     
     embed = BetterEmbed(title=f"{page.name} | {page.magic}")
     fields = (
         ('Tags', ', '.join(page.tags), False),
         ('Japanese name', page.jname),
         ('Page amount', page.pages),
         ('Galeries id', page.gid)
     )
     return embed.set_image(url=page.cover).add_fields(fields)