diff --git a/sopel_modules/SpiceBot/Commands.py b/sopel_modules/SpiceBot/Commands.py index 5243a09..5194f62 100644 --- a/sopel_modules/SpiceBot/Commands.py +++ b/sopel_modules/SpiceBot/Commands.py @@ -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 diff --git a/sopel_modules/SpiceBot/DictComs.py b/sopel_modules/SpiceBot/DictComs.py index e2b8467..098c20f 100644 --- a/sopel_modules/SpiceBot/DictComs.py +++ b/sopel_modules/SpiceBot/DictComs.py @@ -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' diff --git a/sopel_modules/SpiceBot/Read.py b/sopel_modules/SpiceBot/Read.py index 9d0ecb5..95473e3 100644 --- a/sopel_modules/SpiceBot/Read.py +++ b/sopel_modules/SpiceBot/Read.py @@ -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: