packaging and testing
This commit is contained in:
@ -11,7 +11,7 @@ from .lookup import lookupFuncs
|
||||
from .other import movie, generators
|
||||
from .swfuncs import swchar, swroll
|
||||
|
||||
def roll_dice(author, rollStr: str = "1d20"):
|
||||
def roll_dice(author : str, rollStr : str = "1d20"):
|
||||
print("Rolling "+str(rollStr))
|
||||
if rollStr == '0/0': # easter eggs
|
||||
return("What do you expect me to do, destroy the universe?")
|
||||
@ -19,7 +19,7 @@ def roll_dice(author, rollStr: str = "1d20"):
|
||||
adv = 0
|
||||
if re.search('(^|\s+)(adv|dis)(\s+|$)', rollStr) is not None:
|
||||
adv = 1 if re.search('(^|\s+)adv(\s+|$)', rollStr) is not None else -1
|
||||
rollStr = re.sub('(adv|dis)(\s+|$)', '', rollStr)
|
||||
rollStr = re.sub('(adv|dis)(\s+|$)', '', rollSt
|
||||
res = dice.roll(rollStr, adv=adv)
|
||||
out = res.result
|
||||
outStr = author + ' :game_die:\n' + out
|
||||
@ -100,50 +100,3 @@ def imageFunc():
|
||||
print("Successfully returned an image")
|
||||
print("")
|
||||
return(image)
|
||||
|
||||
def movieFunc():
|
||||
try:
|
||||
print("Creating IMDb object")
|
||||
ia = imdb.IMDb()
|
||||
|
||||
print("Picking a movie")
|
||||
movs = open("funcs/other/movies.txt", "r")
|
||||
movlist = movs.read().split("\n")
|
||||
mov = random.choice(movlist)
|
||||
movs.close()
|
||||
|
||||
print("Searching for "+mov)
|
||||
s_result = ia.search_movie(mov)
|
||||
|
||||
print("Getting the data")
|
||||
movie = s_result[0]
|
||||
ia.update(movie)
|
||||
cast = movie['cast']
|
||||
pcast = ""
|
||||
for x in range(3):
|
||||
if cast[x]:
|
||||
pcast += cast[x]['name']+", "
|
||||
print("Successfully ran !movie")
|
||||
print("")
|
||||
return(movie['title'], movie['plot'][0].split("::")[0], movie['cover url'].replace("150","600").replace("101","404"), pcast[:-2])
|
||||
except:
|
||||
print("Something bad happened...")
|
||||
return("error","","","")
|
||||
|
||||
def parseChar(user : str, cmd : str = ""):
|
||||
return swchar.parseChar(user,cmd)
|
||||
|
||||
def parseRoll(user : str, cmd : str = ""):
|
||||
return swroll.parseRoll(user,cmd)
|
||||
|
||||
def spellFunc(content):
|
||||
return lookupFuncs.spellFunc(content)
|
||||
|
||||
def monsterFunc(content):
|
||||
return lookupFuncs.monsterFunc(content)
|
||||
|
||||
def nameGen():
|
||||
return generators.nameGen()
|
||||
|
||||
def tavernGen():
|
||||
return generators.tavernGen()
|
||||
|
Reference in New Issue
Block a user