Cleanup in resources
This commit is contained in:
@ -34,7 +34,7 @@ async def on_message(message):
|
||||
localtime = time.asctime( time.localtime(time.time()) )
|
||||
print("\n"+localtime+"\n"+message.author.name+" ran !help")
|
||||
logging.info("\n"+localtime+"\n"+message.author.name+" ran !help")
|
||||
with codecs.open("help.txt",encoding="utf-8") as f:
|
||||
with codecs.open("resources/help.txt",encoding="utf-8") as f:
|
||||
text = f.read()
|
||||
print(text)
|
||||
em = discord.Embed(title = "Help", description = text,colour = 0x59f442)
|
||||
|
@ -7,9 +7,6 @@ import urllib #used by imageFunc
|
||||
import imdb #used by movieFunc
|
||||
|
||||
from .roll import dice
|
||||
from .lookup import lookupFuncs
|
||||
from .other import movie, generators
|
||||
from .swfuncs import swchar, swroll
|
||||
|
||||
def roll_dice(author : str, rollStr : str = "1d20"):
|
||||
print("Rolling "+str(rollStr))
|
||||
|
@ -25,7 +25,7 @@ def monsterFunc(content):
|
||||
logging.info("Monster doesn't exist in database\n")
|
||||
return("I don't know that monster...","","","","","")
|
||||
else:
|
||||
data = json.load(open('funcs/lookup/monsters.json', encoding = "utf8"))
|
||||
data = json.load(open('resources/monsters.json', encoding = "utf8"))
|
||||
for monster in data:
|
||||
if str(command) == monster["name"]:
|
||||
print("Found it!")
|
||||
@ -117,7 +117,7 @@ def spellFunc(content):
|
||||
command = gf.cap(content.lower().replace("!spell ",""))
|
||||
print("Looking up "+command)
|
||||
logging.info("Looking up "+command)
|
||||
data = json.load(open('funcs/lookup/spells.json', encoding = "utf8"))
|
||||
data = json.load(open('resources/spells.json', encoding = "utf8"))
|
||||
if str(command) in data:
|
||||
print("Returning spell information")
|
||||
logging.info("Returning spell information")
|
||||
|
@ -8,7 +8,7 @@ def make_pairs(corpus):
|
||||
yield (corpus[i], corpus[i+1])
|
||||
|
||||
def nameGen():
|
||||
names = open('funcs/other/names.txt', encoding='utf8').read()
|
||||
names = open('resources/names.txt', encoding='utf8').read()
|
||||
corpus = list(names)
|
||||
|
||||
pairs = make_pairs(corpus)
|
||||
|
@ -7,7 +7,7 @@ def movieFunc():
|
||||
ia = imdb.IMDb()
|
||||
|
||||
print("Picking a movie")
|
||||
movs = open("funcs/other/movies.txt", "r")
|
||||
movs = open("resources/movies.txt", "r")
|
||||
movlist = movs.read().split("\n")
|
||||
mov = random.choice(movlist)
|
||||
movs.close()
|
||||
|
@ -2,7 +2,7 @@ import json
|
||||
import string
|
||||
|
||||
def getName(user : str):
|
||||
with open("funcs/swfuncs/characters.json", "r") as f:
|
||||
with open("resources/swcharacters.json", "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
if user in data:
|
||||
@ -81,7 +81,7 @@ def characterSheet(character : dict):
|
||||
return name, text1+"\n\n"+text2+divider+text3
|
||||
|
||||
def charData(user : str,cmd : str):
|
||||
with open("funcs/swfuncs/characters.json", "r") as f:
|
||||
with open("resources/swcharacters.json", "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
key = string.capwords(cmd.split(" ")[0])
|
||||
@ -107,7 +107,7 @@ def charData(user : str,cmd : str):
|
||||
|
||||
if type(lookUpResult) is dict:
|
||||
data[user][key] = lookUpResult
|
||||
with open("funcs/swfuncs/characters.json", "w") as f:
|
||||
with open("resources/swcharacters.json", "w") as f:
|
||||
json.dump(data,f,indent = 4)
|
||||
return "Changed " + data[user]["Name"] + "'s " + key
|
||||
else:
|
||||
@ -133,7 +133,7 @@ def charData(user : str,cmd : str):
|
||||
return "Can't add that"
|
||||
else:
|
||||
data[user][key] = cmd
|
||||
with open("funcs/swfuncs/characters.json", "w") as f:
|
||||
with open("resources/swcharacters.json", "w") as f:
|
||||
json.dump(data,f,indent = 4)
|
||||
return "Changed " + data[user]["Name"] + "'s " + key +" to " + cmd
|
||||
else:
|
||||
@ -142,7 +142,7 @@ def charData(user : str,cmd : str):
|
||||
return "You don't have a character. You can make one with !swchar"
|
||||
|
||||
def parseChar(user : str, cmd : str):
|
||||
with open("funcs/swfuncs/characters.json", "r") as f:
|
||||
with open("resources/swcharacters.json", "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
if cmd == " ":
|
||||
@ -157,30 +157,30 @@ def parseChar(user : str, cmd : str):
|
||||
if user in data:
|
||||
return characterSheet(data[user])
|
||||
else:
|
||||
with open("funcs/swfuncs/templates.json", "r") as f:
|
||||
with open("resources/swtemplates.json", "r") as f:
|
||||
templates = json.load(f)
|
||||
newChar = templates["Character"]
|
||||
data[user] = newChar
|
||||
with open("funcs/swfuncs/characters.json", "w") as f:
|
||||
with open("resources/swcharacters.json", "w") as f:
|
||||
json.dump(data,f,indent = 4)
|
||||
return "", "Character for " + user + " created"
|
||||
else:
|
||||
if cmd == "purge":
|
||||
del data[user]
|
||||
with open("funcs/swfuncs/characters.json", "w") as f:
|
||||
with open("resources/swcharacters.json", "w") as f:
|
||||
json.dump(data,f,indent = 4)
|
||||
return "", "Character for " + user + " deleted"
|
||||
return "", charData(user,cmd)
|
||||
|
||||
def lightsaberChar(user : str):
|
||||
with open("funcs/swfuncs/characters.json", "r") as f:
|
||||
with open("resources/swcharacters.json", "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
if user in data:
|
||||
return data[user]["Lightsaber Characteristic"]
|
||||
|
||||
def userHasChar(user : str):
|
||||
with open("funcs/swfuncs/characters.json", "r") as f:
|
||||
with open("resources/swcharacters.json", "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
return user in data
|
||||
|
@ -2,10 +2,11 @@ import random
|
||||
import re
|
||||
import string
|
||||
import json
|
||||
import os
|
||||
|
||||
from . import swchar
|
||||
|
||||
with open("funcs/swfuncs/skills.json", "r") as f:
|
||||
with open("resources/swskills.json", "r") as f:
|
||||
skillData = json.load(f)
|
||||
|
||||
def roll(abi : int = 1, prof : int = 0, dif : int = 3, cha : int = 0, boo : int = 0, setb : int = 0, force : int = 0):
|
||||
|
@ -303,13 +303,13 @@ Fantastic Four
|
||||
Fantastic Mr Fox
|
||||
Fargo
|
||||
The Fast and the Furious
|
||||
The Fast and the Furious 2 (2 Fast 2 Furious)
|
||||
The Fast and the Furious 3 (Tokyo Drift)
|
||||
The Fast and the Furious 4 (Fast & Furious)
|
||||
The Fast and the Furious 5 (Fast Five)
|
||||
2 Fast 2 Furious
|
||||
The Fast and the Furious Tokyo Drift
|
||||
Fast & Furious
|
||||
Fast Five
|
||||
The Fast and the Furious 6
|
||||
The Fast and the Furious 7 (Furious 7)
|
||||
The Fast and the Furious 8 (The Fate of the Furious)
|
||||
Furious 7
|
||||
The Fate of the Furious
|
||||
Fast and Furious Presents: Hobbs and Shaw
|
||||
Fast Times of Ridgemont High
|
||||
The Fault in Our Stars
|
Reference in New Issue
Block a user