mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-13 06:59:53 -05:00
add folder values
This commit is contained in:
parent
55c5e32df9
commit
23faf6e4d2
@ -195,6 +195,8 @@ class BotCommands():
|
|||||||
slashsplit = str(modulefile).split("/")
|
slashsplit = str(modulefile).split("/")
|
||||||
filename = slashsplit[-1]
|
filename = slashsplit[-1]
|
||||||
filename_base = os.path.basename(filename).rsplit('.', 1)[0]
|
filename_base = os.path.basename(filename).rsplit('.', 1)[0]
|
||||||
|
folderpath = str(modulefile).split("/" + filename)[0]
|
||||||
|
foldername = str(folderpath).split("/")[-1]
|
||||||
|
|
||||||
detected_lines = []
|
detected_lines = []
|
||||||
for line in module_file_lines:
|
for line in module_file_lines:
|
||||||
@ -251,7 +253,9 @@ class BotCommands():
|
|||||||
"comtype": comtype,
|
"comtype": comtype,
|
||||||
"validcoms": validcoms,
|
"validcoms": validcoms,
|
||||||
"filepath": str(modulefile),
|
"filepath": str(modulefile),
|
||||||
"filename": filename_base,
|
"filename": str(filename_base),
|
||||||
|
"folderpath": str(folderpath),
|
||||||
|
"foldername": str(foldername),
|
||||||
}
|
}
|
||||||
filelinelist.append(validcomdict)
|
filelinelist.append(validcomdict)
|
||||||
currentsuccesslines += 1
|
currentsuccesslines += 1
|
||||||
|
|||||||
@ -64,9 +64,7 @@ class BotJSONCommands():
|
|||||||
|
|
||||||
# check that type is set, use cases will inherit this if not set
|
# check that type is set, use cases will inherit this if not set
|
||||||
if "type" not in list(dict_from_file.keys()):
|
if "type" not in list(dict_from_file.keys()):
|
||||||
foldername = dict_from_file["filepath"].split("/" + dict_from_file["filename"])[0]
|
dict_from_file["type"] = dict_from_file["foldername"]
|
||||||
foldername = str(foldername).split("/")[-1]
|
|
||||||
dict_from_file["type"] = foldername
|
|
||||||
if dict_from_file["type"] not in self.valid_com_types:
|
if dict_from_file["type"] not in self.valid_com_types:
|
||||||
dict_from_file["type"] = 'simple'
|
dict_from_file["type"] = 'simple'
|
||||||
|
|
||||||
|
|||||||
@ -82,6 +82,8 @@ class BotRead():
|
|||||||
filecount += 1
|
filecount += 1
|
||||||
dict_from_file["filepath"] = str(filepath)
|
dict_from_file["filepath"] = str(filepath)
|
||||||
dict_from_file["filename"] = str(filename_base)
|
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
|
configs_dict[filename_base] = dict_from_file
|
||||||
|
|
||||||
if filecount:
|
if filecount:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user