From 868bc0e23cfd6f07e4d846d334463b6cbc1691ff Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Tue, 25 Jun 2019 12:13:48 -0400 Subject: [PATCH] test --- sopel_modules/SpiceBot/Prerun.py | 15 +++++---------- sopel_modules/SpiceBot_Core_Commands/DictComs.py | 2 +- sopel_modules/SpiceBot_Core_Commands/Gif.py | 4 ++-- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index a7a028f..2014827 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -23,22 +23,17 @@ def prerun(t_command_type='module'): @functools.wraps(function) def internal_prerun(bot, trigger, *args, **kwargs): - if t_command_type.endswith("_match"): - trigger_command_type = t_command_type.replace("_match", '') - else: - trigger_command_type = t_command_type - - if trigger_command_type not in list(botcommands.dict["commands"].keys()): - return + trigger_command_type = str(t_command_type) # Primary command used for trigger, and a list of all words trigger_args, trigger_command = make_trigger_args(trigger.args[1], trigger_command_type) - if trigger_command not in list(botcommands.dict["commands"][trigger_command_type].keys()): + trigger_command_type = botcommands.find_command_type(trigger_command) + if not trigger_command_type: return - if t_command_type.endswith("_match"): - if trigger_command_type in ["module", "nickname"]: + if t_command_type != trigger_command_type: + if trigger_command not in list(botcommands.dict["commands"][trigger_command_type].keys()): return # Argsdict Defaults diff --git a/sopel_modules/SpiceBot_Core_Commands/DictComs.py b/sopel_modules/SpiceBot_Core_Commands/DictComs.py index 201b094..9f71e96 100644 --- a/sopel_modules/SpiceBot_Core_Commands/DictComs.py +++ b/sopel_modules/SpiceBot_Core_Commands/DictComs.py @@ -10,7 +10,7 @@ import sopel.module import sopel_modules.SpiceBot as SpiceBot -@SpiceBot.prerun('prefix_match') +@SpiceBot.prerun('module') @sopel.module.commands('(.*)') def command_dictcom(bot, trigger): diff --git a/sopel_modules/SpiceBot_Core_Commands/Gif.py b/sopel_modules/SpiceBot_Core_Commands/Gif.py index d02b179..948338b 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('gif_prefix') +@SpiceBot.prerun('module') @sopel.module.commands('gif') def gif_trigger(bot, trigger): @@ -30,7 +30,7 @@ def gif_trigger(bot, trigger): bot.osd(str(gifdict['gifapi'].title() + " Result (" + str(query) + " #" + str(gifdict["returnnum"]) + "): " + str(gifdict["returnurl"]))) -@SpiceBot.prerun('gif_prefix_match') +@SpiceBot.prerun('module') @sopel.module.commands('(.*)') def gifapi_triggers(bot, trigger):