diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index 06962df..045222f 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -17,6 +17,7 @@ from .Commands import commands as botcommands from .Database import db as botdb from .Channels import channels as botchannels from .MessageLog import messagelog as botmessagelog +from .Config import config as botconfig def prerun(t_command_type='module', t_command_subtype=None): @@ -26,12 +27,18 @@ def prerun(t_command_type='module', t_command_subtype=None): @functools.wraps(function) def internal_prerun(bot, trigger, *args, **kwargs): + if t_command_type == "nickname" and not str(trigger.args[1]).lower().startswith(str(bot.nick).lower()): + return + else: + if not str(trigger.args[1]).startswith(tuple(botconfig.core.prefix_list)): + return + trigger_command_type = str(t_command_type) # Primary command used for trigger, and a list of all words trigger_args, trigger_command, trigger_prefix = make_trigger_args(trigger.args[1], trigger_command_type) - if trigger_prefix == "?": + if trigger_prefix == botconfig.SpiceBot_Commands.query_prefix: return trigger_command_type = botcommands.find_command_type(trigger_command) @@ -98,6 +105,12 @@ def prerun_query(t_command_type='module', t_command_subtype=None): @functools.wraps(function) def internal_prerun(bot, trigger, *args, **kwargs): + if t_command_type == "nickname" and not str(trigger.args[1]).lower().startswith(str(bot.nick).lower()): + return + else: + if not str(trigger.args[1]).startswith(tuple(botconfig.core.prefix_list)): + return + if t_command_subtype != t_command_type: return @@ -106,7 +119,7 @@ def prerun_query(t_command_type='module', t_command_subtype=None): # Primary command used for trigger, and a list of all words trigger_args, trigger_command, trigger_prefix = make_trigger_args(trigger.args[1], trigger_command_type) - if trigger_prefix != "?": + if trigger_prefix != botconfig.SpiceBot_Commands.query_prefix: return # Argsdict Defaults diff --git a/sopel_modules/SpiceBot_Core_Commands/AI.py b/sopel_modules/SpiceBot_Core_Commands/AI.py index 1220827..beeb62f 100644 --- a/sopel_modules/SpiceBot_Core_Commands/AI.py +++ b/sopel_modules/SpiceBot_Core_Commands/AI.py @@ -56,13 +56,13 @@ def bot_command_rule_ai(bot, trigger): trigger_args, trigger_command = SpiceBot.make_trigger_args(message, 'nickname') trigger_args.insert(0, trigger_command) fulltrigger = bot.nick + " " + spicemanip.main(trigger_args, 0) - if str(trigger_command).startswith("?"): + if str(trigger_command).startswith(bot.config.SpiceBot_Commands.query_prefix): return if fulltrigger in SpiceBot.commands.dict['nickrules']: return if trigger_command in list(SpiceBot.commands.dict['commands']["nickname"].keys()): return - elif str(message).lower().startswith("?"): + elif str(message).lower().startswith(bot.config.SpiceBot_Commands.query_prefix): # no query commands detection here return elif str(message).startswith(tuple(bot.config.core.prefix_list)): diff --git a/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py b/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py index c335c64..6820f03 100644 --- a/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py +++ b/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py @@ -27,7 +27,7 @@ def query_detection_nick(bot, trigger): if not trigger.sb['com'] or not len(trigger.sb['com']): return - if not trigger.sb['com'][0] == "?": + if not trigger.sb['com'][0] == bot.config.SpiceBot_Commands.query_prefix: return trigger.sb['com'] = trigger.sb['com'][1:] @@ -60,7 +60,7 @@ def query_detection_nick(bot, trigger): bot.osd("The following " + bot.nick + " commands match " + str(trigger.sb['com']) + ": " + spicemanip.main(validcomlist, 'andlist') + ".", trigger.nick, 'notice') return - if trigger.sb['com'].endswith("?"): + if trigger.sb['com'].endswith(bot.config.SpiceBot_Commands.query_prefix): trigger.sb['com'] = trigger.sb['com'][:-1] if not trigger.sb['com'] or not len(trigger.sb['com']):