This commit is contained in:
deathbybandaid 2019-06-27 12:10:50 -04:00
parent 5005bb40fb
commit 72fd1bb484
2 changed files with 9 additions and 5 deletions

View File

@ -88,13 +88,17 @@ def prerun(t_command_type='module', t_command_subtype=None):
return actual_decorator
def prerun_q(t_command_type='module'):
def prerun_query(t_command_type='module', t_command_subtype=None):
def actual_decorator(function):
@functools.wraps(function)
def internal_prerun(bot, trigger, *args, **kwargs):
if t_command_subtype:
if t_command_subtype != 'query':
return
trigger_command_type = str(t_command_type)
# Primary command used for trigger, and a list of all words
@ -117,7 +121,7 @@ def prerun_q(t_command_type='module'):
argsdict_default["comtext"] = "'?query_command'"
argsdict_default["realcomtext"] = "'?query_command'"
argsdict_default["realcomref"] = "query_query"
argsdict_default["realcomref"] = "nickname_query"
argsdict_default["dict"] = {
"author": "deathbybandaid",

View File

@ -12,14 +12,14 @@ import spicemanip
import sopel_modules.SpiceBot as SpiceBot
@SpiceBot.prerun_q('nickname')
@SpiceBot.prerun('nickname')
@sopel.module.nickname_commands('query')
def query_trigger(bot, trigger):
bot.osd("I have been programmed to help find new commands by using `?`.")
@SpiceBot.events.check_ready([SpiceBot.events.BOT_COMMANDS])
@SpiceBot.prerun_q('nickname')
@SpiceBot.prerun_query('nickname', 'query')
@sopel.module.nickname_commands('(.*)')
def query_detection_nick(bot, trigger):
@ -85,7 +85,7 @@ def query_detection_nick(bot, trigger):
@SpiceBot.events.check_ready([SpiceBot.events.BOT_COMMANDS])
@SpiceBot.prerun_q('module')
@SpiceBot.prerun_query('module', 'query')
@sopel.module.rule('^\?(.*)')
def query_detection(bot, trigger):