Ejemplo n.º 1
0
    async def nhentai(self, ctx, doujin_id: str,*, query=""): #! veiw information about the doujin, nama, artist, etc. 
        '''View the doujin, tags, artist and stuff, powered by nhentai.net, subcommands for more specific searches available'''

        if doujin_id.isnumeric():
            doujin = nhenpy.NHentaiDoujin(f"/g/{doujin_id}")

            if not await self.doujin_found(doujin, ctx.message.channel):
                return

            embed_msg = await ctx.send(embed=self.doujin_embed(doujin, ctx.message.author, doujin_id))
            await self.doujin_react(doujin=doujin, ctx=ctx, embed_msg=embed_msg, wait_time=120)

        elif doujin_id.lower() == "random":
            await self.random(ctx)
            
        elif doujin_id.lower() == "parody":
            await self.parody(ctx, query=query)
            
        elif doujin_id.lower() == "artist":
            await self.artist(ctx, query=query)
            
        elif doujin_id.lower() == "character":
            await self.character(ctx, query=query)

        else:
            await ctx.send(">>> Enter the `ID` of the doujin you wanna look up.")
Ejemplo n.º 2
0
 async def release(self, ctx: commands.Context):
     """Send your entire vault to ur DM"""
     
     ctx = await self.client.get_context(ctx.message, cls=CustomContext)
         
     user_vault = ctx.States.User.vault      
     content = [nhenpy.NHentaiDoujin(f"/g/{item}") for item in user_vault.values()]
     
     await ctx.send(">>> Your whole vault is being sent to your DM.")
     await ctx.author.send(">>> Here's your vault, enjoy!")
     
     for item in content:
         await ctx.author.send(embed=self.doujin_embed(doujin=item, author=ctx.author, doujin_id=item.number))
         
     await ctx.author.send("That's all folks.")
Ejemplo n.º 3
0
 async def pop(self, ctx: commands.Context, index):
     """Remove item from vault, for when u add a doujin to vault and later find out it was necrophilia"""
     
     try:
         i = int(index)
     except:
         await ctx.send(">>> Indexes are supposed to be numbers.")
         return
     
     removed_id = self.vault_remove(ctx.author, index=index)
     removed_name = nhenpy.NHentaiDoujin(f"/g/{removed_id}").title
     
     if removed_id is None:
         await ctx.send(">>> The index you entered is bigger than the size of your vault.")
         return
     
     await ctx.send(f">>> Removed `{removed_name}` from your vault")
Ejemplo n.º 4
0
    async def read(self, ctx, doujin_id): #! makes a different channel in the doujins categoryand posts all doujin images there
        '''Read the doujin, will create a seperate channel and post all images there. Recommend muting the doujin category.'''

        doujin = nhenpy.NHentaiDoujin(f"/g/{doujin_id}")
        doujin_pages = len(doujin.pages)
        url = f"https://nhentai.net/g/{doujin_id}/"

        if not await self.doujin_found(doujin, ctx.message.channel):
            return

        category = discord.utils.get(
            ctx.guild.categories, name=ctx.States.Guild.doujin_category)
        category: discord.CategoryChannel

        channel_exists = False
        channel_exists = not discord.utils.get(
            ctx.guild.text_channels, name=doujin_id) == None

        if not channel_exists:
            channel = await ctx.guild.create_text_channel(str(doujin_id), nsfw=True, category=category)

            await ctx.send(f">>> Go to {channel.mention} and enjoy your doujin!")

            doujin_images = doujin.pages

            embed = discord.Embed(title=doujin.title,
                                  url=url, color=discord.Colour.red())
            embed.set_footer(
                text=f"Requested By: {ctx.message.author.display_name}", icon_url=ctx.message.author.avatar_url)

            image_index = 1
            for image in doujin_images:
                embed.description = f"Page **{image_index}** of ***{doujin_pages}***"
                embed.set_image(url=image)

                image_index += 1

                await channel.send(embed=embed)

        elif channel_exists:
            channel = discord.utils.get(ctx.guild.text_channels, name=doujin_id)

            await ctx.send(f">>> Go to {channel.mention} and enjoy your doujin!")
Ejemplo n.º 5
0
 async def vault(self, ctx: commands.Context):
     """The holy VAULT is where you store all your culture, use subcommands to release it to ur dm and do ther stuff."""
      
     if ctx.invoked_subcommand is None:
         ctx = await self.client.get_context(ctx.message, cls=CustomContext)
         
         user_vault = ctx.States.User.vault
         
         if user_vault == {}:
             await ctx.send("Looks like your vault is empty! Add doujins to your vault by pressing ⭐ on the doujin embed")
             return
         content = [nhenpy.NHentaiDoujin(f"/g/{item}") for item in user_vault.values()]
         
         embed: discord.Embed = discord.Embed(title=f"{ctx.author.name}'s vault",
                                             color=discord.Color.from_rgb(255, 9, 119))
         embed.set_thumbnail(url=self.nhentai_logo) 
         embed.set_author(name="Me!Me!Me!",
                         icon_url=self.client.user.avatar_url)
         
         for index, item in enumerate(content):
             item_id = str(item).split("]")[0][2:]
             embed.add_field(name=f"{index + 1}.", value=f"{item.title} -> ***{item_id}***", inline=False)
             
         await ctx.send(embed=embed)
Ejemplo n.º 6
0
    async def watch(self, ctx, doujin_id, page_number=1): #! reaction navigation approach to read command
        '''Watch the doujin, like a slideshow. Navigate using reactions. The doujin will self delete after being left idle for 3 minutes.'''

        async def reactions_add(message, reactions):
            for reaction in reactions:
                await message.add_reaction(reaction)

        reactions = {"long_back": "⏪", "back": "⬅", "forward": "➡",
                     "long_forward": "⏩", "info": "ℹ", "delete": "❌"}
        
        page = page_number
        wait_time = 180

        doujin = nhenpy.NHentaiDoujin(f"/g/{doujin_id}")
        doujin_pages = doujin.get_images()
        url = f"https://nhentai.net/g/{doujin_id}/"

        if not await self.doujin_found(doujin, ctx.message.channel):
            return

        embed = discord.Embed(title=doujin.title, url=url,
                              color=discord.Colour.red())

        update_page = self.update_doujin_page_creater(embed, doujin)
        embed = update_page(page_number)

        embed_msg = await ctx.send(embed=embed)
        embed_msg: discord.Message

        self.client.loop.create_task(reactions_add(embed_msg, reactions.values()))

        while True:

            try:
                reaction, user = await self.client.wait_for('reaction_add', timeout=wait_time,
                                                             check=lambda reaction, user: user == ctx.author and reaction.message.id == embed_msg.id)
            except TimeoutError:
                await embed_msg.clear_reactions()
                return

            else:
                await embed_msg.remove_reaction(str(reaction.emoji), ctx.author)

                if str(reaction.emoji) in reactions.values():

                    if str(reaction.emoji) == reactions["forward"]:
                        page += 1

                        if page > len(doujin_pages):
                            page = len(doujin_pages)

                        embed = update_page(page)
                        await embed_msg.edit(embed=embed)

                    elif str(reaction.emoji) == reactions["back"]:
                        page -= 1

                        if page < 0:
                            page = 1  

                        embed = update_page(page)
                        await embed_msg.edit(embed=embed)

                    elif str(reaction.emoji) == reactions["long_back"]:
                        page -= len(doujin_pages) // 10

                        if page < 0:
                            page = 1

                        embed = update_page(page)
                        await embed_msg.edit(embed=embed)

                    elif str(reaction.emoji) == reactions["long_forward"]:
                        page += len(doujin_pages) // 10

                        if page >= len(doujin_pages):
                            page = len(doujin_pages)

                        embed = update_page(page)
                        await embed_msg.edit(embed=embed)

                    elif str(reaction.emoji) == reactions["info"]:
                        await ctx.send(embed=self.doujin_embed(doujin, ctx.message.author, doujin_id))

                    elif str(reaction.emoji) == reactions["delete"]:
                        await embed_msg.delete(delay=1)

                        return

                else:
                    pass