add folder values

This commit is contained in:
deathbybandaid 2019-06-20 11:58:55 -04:00
parent 55c5e32df9
commit 23faf6e4d2
3 changed files with 8 additions and 4 deletions

View File

@ -195,6 +195,8 @@ class BotCommands():
slashsplit = str(modulefile).split("/")
filename = slashsplit[-1]
filename_base = os.path.basename(filename).rsplit('.', 1)[0]
folderpath = str(modulefile).split("/" + filename)[0]
foldername = str(folderpath).split("/")[-1]
detected_lines = []
for line in module_file_lines:
@ -251,7 +253,9 @@ class BotCommands():
"comtype": comtype,
"validcoms": validcoms,
"filepath": str(modulefile),
"filename": filename_base,
"filename": str(filename_base),
"folderpath": str(folderpath),
"foldername": str(foldername),
}
filelinelist.append(validcomdict)
currentsuccesslines += 1

View File

@ -64,9 +64,7 @@ class BotJSONCommands():
# check that type is set, use cases will inherit this if not set
if "type" not in list(dict_from_file.keys()):
foldername = dict_from_file["filepath"].split("/" + dict_from_file["filename"])[0]
foldername = str(foldername).split("/")[-1]
dict_from_file["type"] = foldername
dict_from_file["type"] = dict_from_file["foldername"]
if dict_from_file["type"] not in self.valid_com_types:
dict_from_file["type"] = 'simple'

View File

@ -82,6 +82,8 @@ class BotRead():
filecount += 1
dict_from_file["filepath"] = str(filepath)
dict_from_file["filename"] = str(filename_base)
dict_from_file["folderpath"] = dict_from_file["filepath"].split("/" + dict_from_file["filename"])[0]
dict_from_file["foldername"] = str(dict_from_file["folderpath"]).split("/")[-1]
configs_dict[filename_base] = dict_from_file
if filecount: