diff --git a/sopel_modules/SpiceBot/Gif.py b/sopel_modules/SpiceBot/Gif.py index 231462f..94708a7 100644 --- a/sopel_modules/SpiceBot/Gif.py +++ b/sopel_modules/SpiceBot/Gif.py @@ -60,11 +60,11 @@ class BotGif(): self.valid_api[gif_api]["apikey"] = apikey for validgifapi in list(self.valid_api.keys()): + botcommands.dict['counts'] += 1 command_dict = { "comtype": "gif_prefix", "validcoms": [validgifapi] } - botcommands.dict['counts'] += 1 botcommands.register(command_dict) def setup_gif(self): diff --git a/sopel_modules/SpiceBot/Read.py b/sopel_modules/SpiceBot/Read.py index 0f3a056..c23dda5 100644 --- a/sopel_modules/SpiceBot/Read.py +++ b/sopel_modules/SpiceBot/Read.py @@ -15,8 +15,18 @@ class BotRead(): def __init__(self): self.dict = dict() - def config_dir(self): - return + def get_config_dirs(self, config_dir_name): + dir_to_scan = [] + for plugin_dir in set(sopel_modules.__path__): + configsdir = os.path.join(plugin_dir, "SpiceBot_Configs") + cfgdir = os.path.join(configsdir, config_dir_name) + dir_to_scan.append(cfgdir) + + extradir = eval("botconfig." + config_dir_name) + if len(extradir): + for extracfgdir in extradir: + dir_to_scan.append(extracfgdir) + return dir_to_scan def json_to_dict(self, directories, configtypename="Config File", log_from='read_directory_json_to_dict', logging=True): diff --git a/sopel_modules/SpiceBot_Core_Processing/StartupMonologue.py b/sopel_modules/SpiceBot_Core_Processing/StartupMonologue.py index f8aafab..ec49264 100644 --- a/sopel_modules/SpiceBot_Core_Processing/StartupMonologue.py +++ b/sopel_modules/SpiceBot_Core_Processing/StartupMonologue.py @@ -33,10 +33,15 @@ def bot_startup_monologue_channels(bot, trigger): @sopel.module.event(SpiceBot.events.BOT_COMMANDS) @sopel.module.rule('.*') def bot_startup_monologue_commands(bot, trigger): - availablecomsnum, availablecomsfiles = 0, 0 + availablecomsnum, availablecomsfiles = 0, [] for commandstype in list(SpiceBot.commands.dict['commands'].keys()): availablecomsnum += len(list(SpiceBot.commands.dict['commands'][commandstype].keys())) - availablecomsfiles += SpiceBot.commands.dict['counts'] + for validcom in list(SpiceBot.commands.dict['commands'][commandstype].keys()): + if "filepath" in list(SpiceBot.commands.dict['commands'][commandstype][validcom].keys()): + filepath = SpiceBot.commands.dict['commands'][commandstype][validcom]["filepath"].lower() + if filepath not in availablecomsfiles: + availablecomsfiles.append(filepath) + availablecomsfiles = len(availablecomsfiles) displayval = "There are " + str(availablecomsnum) + " commands available in " + str(availablecomsfiles) + " files." SpiceBot.startupmonologue.dict["commands"] = displayval SpiceBot.logs.log('SpiceBot_StartupMonologue', displayval)