aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bot.py16
-rw-r--r--henti.py45
2 files changed, 37 insertions, 24 deletions
diff --git a/bot.py b/bot.py
index 6cc04d1..0be1c79 100644
--- a/bot.py
+++ b/bot.py
@@ -4,25 +4,29 @@ import random
from dotenv import load_dotenv
from discord.ext import commands
-from henti import Numbers as n
+from henti import Numbers
load_dotenv() # load .env file
TOKEN = os.getenv('DISCORD_TOKEN')
-bot = commands.Bot(command_prefix='z!') # initialise the bot
+
+PREFIXES = ['z!', '?'] # prefixes for the bot's commands
+bot = commands.Bot(command_prefix=PREFIXES) # initialise the bot with pre-defined prefixes
# get title of henti
-@bot.command(name='info', help='Get the title of doujin using the holy numbers')
+@bot.command(name='info', help='Get the info about a doujin using the holy numbers')
async def getInfo(ctx, sauce):
- r = n(sauce).title()
+ doujin = Numbers(sauce)
+ r = doujin.title()
await ctx.send(r)
# short for the same
-@bot.command(name='i', help='short fot z!title')
+@bot.command(name='i', help='short fot z!info')
async def getInfo(ctx, sauce):
- r = n(sauce).title()
+ doujin = Numbers(sauce)
+ r = doujin.info()
await ctx.send(r)
diff --git a/henti.py b/henti.py
index a6b0738..abaefa0 100644
--- a/henti.py
+++ b/henti.py
@@ -2,30 +2,39 @@ from hentai import Hentai
from hentai import Format
class Numbers:
- def __init__(self, number):
- self.sauce = Hentai(number)
-
def title(self):
title = self.sauce.title(Format.Pretty)
return title
-"""
+
def artist(self):
- artist = str(Hentai(sauce).artist).split(', ')[2] # name='artist'
+ artist = str(self.sauce.artist).split(', ')[2]
name = artist[6:-1] # just the artist's name
return name
- def tags():
- # get a henti's tags
- pass
+ def Tags(self):
+ tags = []
+ for tag in self.sauce.tag:
+ # get names of tags and put them in a list
+ tags.append(tag.name)
+ print(tags)
+
+
+
+
+
+
+ def __init__(self, number):
+ sauce = Hentai(number)
+ self.sauce = sauce
+
+
+
- def get_title(sauce):
+# def info(self):
# get hentai title in readable format
- title = str(Hentai(sauce).title(Format.Pretty))
- artist = get_artist(sauce)
- r = "{title} ({sauce}) by {artist}\nhttps://nhentai.net/g/{sauce}/".format(title=title, artist=artist, sauce=sauce)
- return r
-"""
-# print(Numbers(177013).title())
-# print(Numbers.title(177013))
-# print(Numbers.title(177013))
-# print(x.title())
+# _title = Numbers.title(self.sauce)
+# _artist = Numbers.artist(self.sauce)
+# _tags = Numbers.tags(self.sauce)
+# sauce = self.sauce
+# r = "{title} ({sauce}) by {artist}\nhttps://nhentai.net/g/{sauce}/"#.format(title=title, artist=artist, sauce=sauce)
+# return r