src/cogs/apis.py
async def danbooru(self, ctx, *, tags=''):
        """Show a random image from Danbooru.

        tag: str
        Optional tag(s) for narrowing image search.
        """

        for tag in self.config['blacklist']:
            if tag in tags.lower():
                return await ctx.reply("The specified tag(s) are blacklisted.")

        url = (
            f'https://danbooru.donmai.us/'
            f'posts.json?limit=200&tags={tags}')
        data, status = await self.get_data(url)

        if data and status:
            return await ctx.reply(f"{status}: {data['message']}")

        if len(data) == 0:
            return await ctx.reply(
                "The specified tag(s) returned no results."
                )

        post = random.choice(data)
        msg = await ctx.send(post['file_url'])
        self.image_cache[ctx.author.id] = msg.id
Show a random image from Danbooru.

        tag: str
        Optional tag(s) for narrowing image search.
        
Show a random image from Danbooru.
tag: str
Optional tag(s) for narrowing image search.
Show a random image from Danbooru . tag : str Optional tag ( s ) for narrowing image search .
async def danbooru(self, ctx, *, tags=''):
        for tag in self.config['blacklist']:
            if tag in tags.lower():
                return await ctx.reply("The specified tag(s) are blacklisted.")
        url = (
            f'https://danbooru.donmai.us/'
            f'posts.json?limit=200&tags={tags}')
        data, status = await self.get_data(url)
        if data and status:
            return await ctx.reply(f"{status}: {data['message']}")
        if len(data) == 0:
            return await ctx.reply(
                "The specified tag(s) returned no results."
                )
        post = random.choice(data)
        msg = await ctx.send(post['file_url'])
        self.image_cache[ctx.author.id] = msg.id
async def danbooru ( self , ctx , * , tags = '' ) : for tag in self . config [ 'blacklist' ] : if tag in tags . lower ( ) : return await ctx . reply ( "The specified tag(s) are blacklisted." ) url = ( f'https://danbooru.donmai.us/' f'posts.json?limit=200&tags={tags}' ) data , status = await self . get_data ( url ) if data and status : return await ctx . reply ( f"{status}: {data['message']}" ) if len ( data ) == 0 : return await ctx . reply ( "The specified tag(s) returned no results." ) post = random . choice ( data ) msg = await ctx . send ( post [ 'file_url' ] ) self . image_cache [ ctx . author . id ] = msg . id
Show a random image from Danbooru.
Show a random image from Danbooru .
"""Show a random image from Danbooru.

        tag: str
        Optional tag(s) for narrowing image search.
        """
self
ctx
tags