diff --git a/sopel_modules/SpiceBot/DictComs.py b/sopel_modules/SpiceBot/DictComs.py index 4267700..cf776cc 100644 --- a/sopel_modules/SpiceBot/DictComs.py +++ b/sopel_modules/SpiceBot/DictComs.py @@ -50,7 +50,7 @@ class BotDictCommands(): # simplify usage of the bot command going forward # copy dict to not overwrite - triggersb['comdict'] = copy.deepcopy(botcommands.dict['commands']["prefix"][triggersb['realcom']]) + triggersb['comdict'] = copy.deepcopy(botcommands.dict['commands']["dictcom"][triggersb['realcom']]) # execute function based on command type triggersb['comtype'] = triggersb['comdict']["type"].lower() @@ -71,7 +71,7 @@ class BotDictCommands(): dict_from_file = self.valid_dictcom_dict[jsondict] - dict_from_file["comtype"] = "prefix" + dict_from_file["comtype"] = "dictcom" # default command to filename if "validcoms" not in list(dict_from_file.keys()): diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index 851d30b..a36830c 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -9,6 +9,7 @@ from sopel.tools import Identifier import functools import copy import datetime + import spicemanip from .Tools import command_permissions_check @@ -16,7 +17,7 @@ from .Commands import commands as botcommands from .Database import db as botdb -def prerun(t_command_type='module'): +def prerun(t_command_type='module', t_command_subtype=None): def actual_decorator(function): @@ -32,16 +33,8 @@ def prerun(t_command_type='module'): if not trigger_command_type: return - if trigger_command_type not in list(botcommands.dict["commands"].keys()): - return - - if trigger_command not in list(botcommands.dict["commands"][trigger_command_type].keys()): - return - - if trigger_command_type != t_command_type: - if t_command_type not in list(botcommands.dict["commands"].keys()): - return - if trigger_command in list(botcommands.dict["commands"][t_command_type].keys()): + if t_command_subtype: + if trigger_command_type != trigger_command_type: return # Argsdict Defaults diff --git a/sopel_modules/SpiceBot/Tools.py b/sopel_modules/SpiceBot/Tools.py index 84464e6..79b24c0 100644 --- a/sopel_modules/SpiceBot/Tools.py +++ b/sopel_modules/SpiceBot/Tools.py @@ -9,7 +9,6 @@ import sopel import collections import os import sys -import codecs from difflib import SequenceMatcher from operator import itemgetter from collections import abc diff --git a/sopel_modules/SpiceBot_Core_Commands/DictComs.py b/sopel_modules/SpiceBot_Core_Commands/DictComs.py index 52f80b8..ffff1a4 100644 --- a/sopel_modules/SpiceBot_Core_Commands/DictComs.py +++ b/sopel_modules/SpiceBot_Core_Commands/DictComs.py @@ -10,12 +10,11 @@ import sopel.module import sopel_modules.SpiceBot as SpiceBot -@SpiceBot.prerun('module') +@SpiceBot.prerun('module', 'dictcom') @sopel.module.commands('(.*)') def command_dictcom(bot, trigger): - bot.say("here") - if trigger.sb['com'] not in list(SpiceBot.commands.dict['commands']["prefix"].keys()): + if trigger.sb['com'] not in list(SpiceBot.commands.dict['commands']["dictcom"].keys()): return trigger.sb = SpiceBot.dictcoms.get_dict(trigger.sb) diff --git a/sopel_modules/SpiceBot_Core_Commands/Gif.py b/sopel_modules/SpiceBot_Core_Commands/Gif.py index 40cd25e..5188f8e 100644 --- a/sopel_modules/SpiceBot_Core_Commands/Gif.py +++ b/sopel_modules/SpiceBot_Core_Commands/Gif.py @@ -11,7 +11,7 @@ import spicemanip # TODO custom gif shortcut commands -@SpiceBot.prerun('module') +@SpiceBot.prerun('module', "gif_prefix") @sopel.module.commands('gif') def gif_trigger(bot, trigger): @@ -33,7 +33,6 @@ def gif_trigger(bot, trigger): @SpiceBot.prerun('module') @sopel.module.commands('(.*)') def gifapi_triggers(bot, trigger): - bot.say("here") if trigger.sb['com'] not in list(SpiceBot.gif.valid_api.keys()): return