From 58082b2f32799a839247f24be94e1941d5ce47f1 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Wed, 26 Jun 2019 15:18:21 -0400 Subject: [PATCH 01/22] improve output --- sopel_modules/SpiceBot/Prerun.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index 8d922ee..0fde755 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -50,11 +50,11 @@ def prerun(t_command_type='module', t_command_subtype=None): argsdict_default["realcom"] = botcommands.get_realcom(argsdict_default["com"], trigger_command_type) if argsdict_default["type"] == 'nickname': - argsdict_default["comtext"] = bot.nick + " " + argsdict_default["com"] - argsdict_default["realcomtext"] = bot.nick + " " + argsdict_default["realcom"] + argsdict_default["comtext"] = "'" + bot.nick + " " + argsdict_default["com"] + "'" + argsdict_default["realcomtext"] = "'" + bot.nick + " " + argsdict_default["realcom"] + "'" else: - argsdict_default["comtext"] = argsdict_default["com"] - argsdict_default["realcomtext"] = argsdict_default["realcom"] + argsdict_default["comtext"] = "'" + argsdict_default["com"] + "'" + argsdict_default["realcomtext"] = "'" + argsdict_default["realcom"] + "'" argsdict_default["dict"] = botcommands.get_command_dict(argsdict_default["realcom"], trigger_command_type) From d357bf69d1fb3586e45f87cc0c87f24a35903453 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Wed, 26 Jun 2019 15:19:46 -0400 Subject: [PATCH 02/22] nope --- sopel_modules/SpiceBot/Prerun.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index 0fde755..8d922ee 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -50,11 +50,11 @@ def prerun(t_command_type='module', t_command_subtype=None): argsdict_default["realcom"] = botcommands.get_realcom(argsdict_default["com"], trigger_command_type) if argsdict_default["type"] == 'nickname': - argsdict_default["comtext"] = "'" + bot.nick + " " + argsdict_default["com"] + "'" - argsdict_default["realcomtext"] = "'" + bot.nick + " " + argsdict_default["realcom"] + "'" + argsdict_default["comtext"] = bot.nick + " " + argsdict_default["com"] + argsdict_default["realcomtext"] = bot.nick + " " + argsdict_default["realcom"] else: - argsdict_default["comtext"] = "'" + argsdict_default["com"] + "'" - argsdict_default["realcomtext"] = "'" + argsdict_default["realcom"] + "'" + argsdict_default["comtext"] = argsdict_default["com"] + argsdict_default["realcomtext"] = argsdict_default["realcom"] argsdict_default["dict"] = botcommands.get_command_dict(argsdict_default["realcom"], trigger_command_type) From adc9b8d3003933d6b003d7de863af2c585406572 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Wed, 26 Jun 2019 15:20:53 -0400 Subject: [PATCH 03/22] dummy --- sopel_modules/SpiceBot/Prerun.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index 8d922ee..0fde755 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -50,11 +50,11 @@ def prerun(t_command_type='module', t_command_subtype=None): argsdict_default["realcom"] = botcommands.get_realcom(argsdict_default["com"], trigger_command_type) if argsdict_default["type"] == 'nickname': - argsdict_default["comtext"] = bot.nick + " " + argsdict_default["com"] - argsdict_default["realcomtext"] = bot.nick + " " + argsdict_default["realcom"] + argsdict_default["comtext"] = "'" + bot.nick + " " + argsdict_default["com"] + "'" + argsdict_default["realcomtext"] = "'" + bot.nick + " " + argsdict_default["realcom"] + "'" else: - argsdict_default["comtext"] = argsdict_default["com"] - argsdict_default["realcomtext"] = argsdict_default["realcom"] + argsdict_default["comtext"] = "'" + argsdict_default["com"] + "'" + argsdict_default["realcomtext"] = "'" + argsdict_default["realcom"] + "'" argsdict_default["dict"] = botcommands.get_command_dict(argsdict_default["realcom"], trigger_command_type) From c287f728cf1e9d5df273cbe528626036d1b424c7 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Wed, 26 Jun 2019 15:50:02 -0400 Subject: [PATCH 04/22] ai command --- sopel_modules/SpiceBot/Prerun.py | 2 +- sopel_modules/SpiceBot_Core_Commands/AI.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index 0fde755..123e9e3 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -191,7 +191,7 @@ def trigger_runstatus(bot, trigger): return trigger_cant_run(bot, trigger, message) else: botcommands.unset_command_disabled(trigger.sb["realcom"], trigger.nick, "fully") - botmessagelog.messagelog_error(trigger.sb["log_id"], trigger.sb["comtext"] + " multirun is now enabled for " + str(trigger.nick)) + botmessagelog.messagelog(trigger.sb["log_id"], trigger.sb["comtext"] + " is now enabled for " + str(trigger.nick)) return True diff --git a/sopel_modules/SpiceBot_Core_Commands/AI.py b/sopel_modules/SpiceBot_Core_Commands/AI.py index e4e80cb..6e22e69 100644 --- a/sopel_modules/SpiceBot_Core_Commands/AI.py +++ b/sopel_modules/SpiceBot_Core_Commands/AI.py @@ -9,9 +9,26 @@ import sopel_modules.SpiceBot as SpiceBot import spicemanip +@SpiceBot.prerun('nickname') +@sopel.module.nickname_commands('ai') +def ai_trigger(bot, trigger): + bot.osd("I have the capability of responding to many requests, but I am not YET sentient.") + + @sopel.module.rule('(.*)') def bot_command_rule_ai(bot, trigger): + # don't run commands that are disabled in channels + if not trigger.is_privmsg: + channel_disabled_list = SpiceBot.commands.get_commands_disabled(str(trigger.sender), "fully") + if "ai" in list(channel_disabled_list.keys()): + return + + # don't run commands that are disabled for specific users + nick_disabled_list = SpiceBot.commands.get_commands_disabled(str(trigger.nick), "fully") + if "ai" in list(nick_disabled_list.keys()): + return + # TODO add config limits # but still allow in privmsg From ec76e0f495e857e899342e144ffc1c35cf18f477 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Wed, 26 Jun 2019 16:00:14 -0400 Subject: [PATCH 05/22] better command reference --- sopel_modules/SpiceBot/Prerun.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index 123e9e3..5112048 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -56,6 +56,8 @@ def prerun(t_command_type='module', t_command_subtype=None): argsdict_default["comtext"] = "'" + argsdict_default["com"] + "'" argsdict_default["realcomtext"] = "'" + argsdict_default["realcom"] + "'" + argsdict_default["realcomref"] = argsdict_default["type"] + "_" + argsdict_default["realcom"] + argsdict_default["dict"] = botcommands.get_command_dict(argsdict_default["realcom"], trigger_command_type) # split into && groupings @@ -167,7 +169,7 @@ def trigger_runstatus(bot, trigger): message = "The " + str(trigger.sb["comtext"]) + " command was multirun unsage disabled by " + bywhom + " for " + str(trigger.sender) + " at " + str(timestamp) + " for the following reason: " + str(reason) return trigger_cant_run(bot, trigger, message) else: - botcommands.unset_command_disabled(trigger.sb["realcom"], trigger.nick, "multirun") + botcommands.unset_command_disabled(trigger.sb["realcomref"], trigger.nick, "multirun") botmessagelog.messagelog_error(trigger.sb["log_id"], trigger.sb["comtext"] + " multirun is now enabled for " + str(trigger.nick)) # don't run commands that are disabled in channels @@ -190,7 +192,7 @@ def trigger_runstatus(bot, trigger): message = "The " + str(trigger.sb["comtext"]) + " command was disabled by " + bywhom + " for " + str(trigger.sender) + " at " + str(timestamp) + " for the following reason: " + str(reason) return trigger_cant_run(bot, trigger, message) else: - botcommands.unset_command_disabled(trigger.sb["realcom"], trigger.nick, "fully") + botcommands.unset_command_disabled(trigger.sb["realcomref"], trigger.nick, "fully") botmessagelog.messagelog(trigger.sb["log_id"], trigger.sb["comtext"] + " is now enabled for " + str(trigger.nick)) return True @@ -272,24 +274,24 @@ def trigger_hyphen_arg_handler(bot, trigger): if trigger.sb["hyphen_arg"] in ['enable', 'unblock', "activate", "on"]: - if not botcommands.check_commands_disabled(trigger.sb["realcom"], target, "fully"): + if not botcommands.check_commands_disabled(trigger.sb["realcomref"], target, "fully"): botmessagelog.messagelog_error(trigger.sb["log_id"], trigger.sb["comtext"] + " is already enabled for " + str(target)) return - botcommands.unset_command_disabled(trigger.sb["realcom"], target, "fully") + botcommands.unset_command_disabled(trigger.sb["realcomref"], target, "fully") botmessagelog.messagelog(trigger.sb["log_id"], trigger.sb["comtext"] + " is now enabled for " + str(target)) return else: - if botcommands.check_commands_disabled(trigger.sb["realcom"], target, "fully"): + if botcommands.check_commands_disabled(trigger.sb["realcomref"], target, "fully"): botmessagelog.messagelog_error(trigger.sb["log_id"], trigger.sb["comtext"] + " is already disabled for " + str(target)) return trailingmessage = spicemanip.main(trigger.sb["args"], 0) or "No reason given." timestamp = str(datetime.datetime.utcnow()) - botcommands.set_command_disabled(trigger.sb["realcom"], target, timestamp, trailingmessage, trigger.nick, "fully") + botcommands.set_command_disabled(trigger.sb["realcomref"], target, timestamp, trailingmessage, trigger.nick, "fully") botmessagelog.messagelog(trigger.sb["log_id"], trigger.sb["comtext"] + " is now disabled for " + str(target)) return @@ -322,24 +324,24 @@ def trigger_hyphen_arg_handler(bot, trigger): if onoff in ['enable', 'unblock', "activate", "on"]: - if not botcommands.check_commands_disabled(trigger.sb["realcom"], target, "multirun"): + if not botcommands.check_commands_disabled(trigger.sb["realcomref"], target, "multirun"): botmessagelog.messagelog_error(trigger.sb["log_id"], trigger.sb["comtext"] + " multirun is already enabled for " + str(target)) return - botcommands.unset_command_disabled(trigger.sb["realcom"], target, "multirun") + botcommands.unset_command_disabled(trigger.sb["realcomref"], target, "multirun") botmessagelog.messagelog(trigger.sb["log_id"], trigger.sb["comtext"] + " multirun is now enabled for " + str(target)) return else: - if botcommands.check_commands_disabled(trigger.sb["realcom"], target, "multirun"): + if botcommands.check_commands_disabled(trigger.sb["realcomref"], target, "multirun"): botmessagelog.messagelog_error(trigger.sb["log_id"], trigger.sb["comtext"] + " multirun is already disabled for " + str(target)) return trailingmessage = spicemanip.main(trigger.sb["args"], 0) or "No reason given." timestamp = str(datetime.datetime.utcnow()) - botcommands.set_command_disabled(trigger.sb["realcom"], target, timestamp, trailingmessage, trigger.nick, "multirun") + botcommands.set_command_disabled(trigger.sb["realcomref"], target, timestamp, trailingmessage, trigger.nick, "multirun") botmessagelog.messagelog(trigger.sb["log_id"], trigger.sb["comtext"] + " multirun is now disabled for " + str(target)) return From 359b41c50152c7ebe381343fb67ad6d9fff9b690 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Wed, 26 Jun 2019 16:02:02 -0400 Subject: [PATCH 06/22] tweak --- sopel_modules/SpiceBot_Core_Commands/AI.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sopel_modules/SpiceBot_Core_Commands/AI.py b/sopel_modules/SpiceBot_Core_Commands/AI.py index 6e22e69..1220827 100644 --- a/sopel_modules/SpiceBot_Core_Commands/AI.py +++ b/sopel_modules/SpiceBot_Core_Commands/AI.py @@ -21,12 +21,12 @@ def bot_command_rule_ai(bot, trigger): # don't run commands that are disabled in channels if not trigger.is_privmsg: channel_disabled_list = SpiceBot.commands.get_commands_disabled(str(trigger.sender), "fully") - if "ai" in list(channel_disabled_list.keys()): + if "nickname_ai" in list(channel_disabled_list.keys()): return # don't run commands that are disabled for specific users nick_disabled_list = SpiceBot.commands.get_commands_disabled(str(trigger.nick), "fully") - if "ai" in list(nick_disabled_list.keys()): + if "nickname_ai" in list(nick_disabled_list.keys()): return # TODO add config limits From bcd05ab0d591089378df80cc7fec80655f96153c Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Wed, 26 Jun 2019 16:07:08 -0400 Subject: [PATCH 07/22] test --- sopel_modules/SpiceBot/Prerun.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index 5112048..08c47c6 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -50,13 +50,13 @@ def prerun(t_command_type='module', t_command_subtype=None): argsdict_default["realcom"] = botcommands.get_realcom(argsdict_default["com"], trigger_command_type) if argsdict_default["type"] == 'nickname': - argsdict_default["comtext"] = "'" + bot.nick + " " + argsdict_default["com"] + "'" - argsdict_default["realcomtext"] = "'" + bot.nick + " " + argsdict_default["realcom"] + "'" + argsdict_default["comtext"] = "'" + bot.nick + " " + str(argsdict_default["com"]) + "'" + argsdict_default["realcomtext"] = "'" + bot.nick + " " + str(argsdict_default["realcom"]) + "'" else: - argsdict_default["comtext"] = "'" + argsdict_default["com"] + "'" - argsdict_default["realcomtext"] = "'" + argsdict_default["realcom"] + "'" + argsdict_default["comtext"] = "'" + str(argsdict_default["com"]) + "'" + argsdict_default["realcomtext"] = "'" + str(argsdict_default["realcom"]) + "'" - argsdict_default["realcomref"] = argsdict_default["type"] + "_" + argsdict_default["realcom"] + argsdict_default["realcomref"] = argsdict_default["type"] + "_" + str(argsdict_default["realcom"]) argsdict_default["dict"] = botcommands.get_command_dict(argsdict_default["realcom"], trigger_command_type) From af5d6629f1e3bc4a322df98e00015b1adca34486 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Wed, 26 Jun 2019 16:10:43 -0400 Subject: [PATCH 08/22] test --- sopel_modules/SpiceBot/Prerun.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index 08c47c6..51da742 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -48,15 +48,16 @@ def prerun(t_command_type='module', t_command_subtype=None): argsdict_default["log_id"] = botmessagelog.messagelog_assign() argsdict_default["realcom"] = botcommands.get_realcom(argsdict_default["com"], trigger_command_type) + argsdict_default["realcom"] = str(argsdict_default["realcom"]) if argsdict_default["type"] == 'nickname': - argsdict_default["comtext"] = "'" + bot.nick + " " + str(argsdict_default["com"]) + "'" - argsdict_default["realcomtext"] = "'" + bot.nick + " " + str(argsdict_default["realcom"]) + "'" + argsdict_default["comtext"] = "'" + bot.nick + " " + argsdict_default["com"] + "'" + argsdict_default["realcomtext"] = "'" + bot.nick + " " + argsdict_default["realcom"] + "'" else: - argsdict_default["comtext"] = "'" + str(argsdict_default["com"]) + "'" - argsdict_default["realcomtext"] = "'" + str(argsdict_default["realcom"]) + "'" + argsdict_default["comtext"] = "'" + argsdict_default["com"] + "'" + argsdict_default["realcomtext"] = "'" + argsdict_default["realcom"] + "'" - argsdict_default["realcomref"] = argsdict_default["type"] + "_" + str(argsdict_default["realcom"]) + argsdict_default["realcomref"] = argsdict_default["type"] + "_" + argsdict_default["realcom"] argsdict_default["dict"] = botcommands.get_command_dict(argsdict_default["realcom"], trigger_command_type) From 8793a518e1591e2e6b66c149ac076cfe1bdf20d8 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Wed, 26 Jun 2019 16:11:33 -0400 Subject: [PATCH 09/22] fixed --- sopel_modules/SpiceBot/Commands.py | 2 +- sopel_modules/SpiceBot/Prerun.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sopel_modules/SpiceBot/Commands.py b/sopel_modules/SpiceBot/Commands.py index 891b5c3..8b70afb 100644 --- a/sopel_modules/SpiceBot/Commands.py +++ b/sopel_modules/SpiceBot/Commands.py @@ -87,7 +87,7 @@ class BotCommands(): return realcom if "aliasfor" in self.dict['commands'][trigger_command_type][command].keys(): - realcom = self.dict['commands'][trigger_command_type][command] + realcom = self.dict['commands'][trigger_command_type][command]["aliasfor"] return realcom diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index 51da742..5112048 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -48,7 +48,6 @@ def prerun(t_command_type='module', t_command_subtype=None): argsdict_default["log_id"] = botmessagelog.messagelog_assign() argsdict_default["realcom"] = botcommands.get_realcom(argsdict_default["com"], trigger_command_type) - argsdict_default["realcom"] = str(argsdict_default["realcom"]) if argsdict_default["type"] == 'nickname': argsdict_default["comtext"] = "'" + bot.nick + " " + argsdict_default["com"] + "'" From 5005bb40fb6783f17bd1df1f028dffd1c5cecec9 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Thu, 27 Jun 2019 12:02:25 -0400 Subject: [PATCH 10/22] test new query system --- sopel_modules/SpiceBot/Prerun.py | 73 +++++++++++++++++++ .../SpiceBot_Core_Commands/CommandsQuery.py | 10 ++- 2 files changed, 81 insertions(+), 2 deletions(-) diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index 5112048..b32b635 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -88,6 +88,79 @@ def prerun(t_command_type='module', t_command_subtype=None): return actual_decorator +def prerun_q(t_command_type='module'): + + def actual_decorator(function): + + @functools.wraps(function) + def internal_prerun(bot, trigger, *args, **kwargs): + + 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) + + # Argsdict Defaults + argsdict_default = {} + argsdict_default["type"] = trigger_command_type + argsdict_default["com"] = trigger_command + + # messagelog ID + argsdict_default["log_id"] = botmessagelog.messagelog_assign() + + argsdict_default["realcom"] = "query_command" + + if argsdict_default["type"] == 'nickname': + argsdict_default["comtext"] = "'" + bot.nick + " ?query_command'" + argsdict_default["realcomtext"] = "'" + bot.nick + " ?query_command'" + else: + argsdict_default["comtext"] = "'?query_command'" + argsdict_default["realcomtext"] = "'?query_command'" + + argsdict_default["realcomref"] = "query_query" + + argsdict_default["dict"] = { + "author": "deathbybandaid", + "contributors": [], + "example": "", + "exampleresponse": "", + "description": "", + "privs": [], + "filename": "", + "filepath": "", + "foldername": "", + "folderpath": "", + "validcoms": [], + } + + # split into && groupings + and_split = trigger_and_split(trigger_args) + + # Create dict listings for trigger.sb + argsdict_list = trigger_argsdict_list(argsdict_default, and_split) + + # Run the function for all splits + botmessagelog.messagelog_start(bot, trigger, argsdict_default["log_id"]) + runcount = 0 + for argsdict in argsdict_list: + runcount += 1 + trigger.sb = copy.deepcopy(argsdict) + + trigger.sb["runcount"] = runcount + + trigger.sb["args"], trigger.sb["hyphen_arg"] = trigger_hyphen_args(trigger.sb["args"]) + if not trigger.sb["hyphen_arg"]: + # check if anything prohibits the nick from running the command + if trigger_runstatus(bot, trigger): + function(bot, trigger, *args, **kwargs) + else: + trigger_hyphen_arg_handler(bot, trigger) + botmessagelog.messagelog_exit(bot, argsdict_default["log_id"]) + + return internal_prerun + return actual_decorator + + def make_trigger_args(triggerargs_one, trigger_command_type='module'): trigger_args = spicemanip.main(triggerargs_one, 'create') if trigger_command_type in ['nickname']: diff --git a/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py b/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py index b6fa9b0..e81570b 100644 --- a/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py +++ b/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py @@ -12,8 +12,14 @@ import spicemanip import sopel_modules.SpiceBot as SpiceBot +@SpiceBot.prerun_q('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('nickname_match') +@SpiceBot.prerun_q('nickname') @sopel.module.nickname_commands('(.*)') def query_detection_nick(bot, trigger): @@ -79,7 +85,7 @@ def query_detection_nick(bot, trigger): @SpiceBot.events.check_ready([SpiceBot.events.BOT_COMMANDS]) -@SpiceBot.prerun('query') +@SpiceBot.prerun_q('module') @sopel.module.rule('^\?(.*)') def query_detection(bot, trigger): From 72fd1bb48471bb84e75aafa7008e72abe36eb616 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Thu, 27 Jun 2019 12:10:50 -0400 Subject: [PATCH 11/22] test --- sopel_modules/SpiceBot/Prerun.py | 8 ++++++-- sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index b32b635..aefd5ed 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -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", diff --git a/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py b/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py index e81570b..a286d56 100644 --- a/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py +++ b/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py @@ -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): From 4e00e303f87c4d700fb347aecb0a2d9447f13956 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Thu, 27 Jun 2019 12:18:19 -0400 Subject: [PATCH 12/22] test return --- sopel_modules/SpiceBot/Prerun.py | 5 ++--- sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index aefd5ed..625124d 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -95,9 +95,8 @@ def prerun_query(t_command_type='module', t_command_subtype=None): @functools.wraps(function) def internal_prerun(bot, trigger, *args, **kwargs): - if t_command_subtype: - if t_command_subtype != 'query': - return + if t_command_subtype != t_command_type: + return trigger_command_type = str(t_command_type) diff --git a/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py b/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py index a286d56..c335c64 100644 --- a/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py +++ b/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py @@ -19,7 +19,7 @@ def query_trigger(bot, trigger): @SpiceBot.events.check_ready([SpiceBot.events.BOT_COMMANDS]) -@SpiceBot.prerun_query('nickname', 'query') +@SpiceBot.prerun_query('nickname', 'nickname') @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_query('module', 'query') +@SpiceBot.prerun_query('module', 'module') @sopel.module.rule('^\?(.*)') def query_detection(bot, trigger): From 0e5076844453a60842935726a7d08eaf24afd5ed Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Thu, 27 Jun 2019 12:19:55 -0400 Subject: [PATCH 13/22] cleanup --- sopel_modules/SpiceBot/Prerun.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index 625124d..066cce3 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -105,20 +105,16 @@ def prerun_query(t_command_type='module', t_command_subtype=None): # Argsdict Defaults argsdict_default = {} - argsdict_default["type"] = trigger_command_type - argsdict_default["com"] = trigger_command + argsdict_default["type"] = 'nickname' + argsdict_default["com"] = "query" # messagelog ID argsdict_default["log_id"] = botmessagelog.messagelog_assign() argsdict_default["realcom"] = "query_command" - if argsdict_default["type"] == 'nickname': - argsdict_default["comtext"] = "'" + bot.nick + " ?query_command'" - argsdict_default["realcomtext"] = "'" + bot.nick + " ?query_command'" - else: - argsdict_default["comtext"] = "'?query_command'" - argsdict_default["realcomtext"] = "'?query_command'" + argsdict_default["comtext"] = "'" + bot.nick + " query'" + argsdict_default["realcomtext"] = "'" + bot.nick + " query'" argsdict_default["realcomref"] = "nickname_query" From 48ce76a8145fd9390f244c465452be982ce6a819 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Thu, 27 Jun 2019 12:21:39 -0400 Subject: [PATCH 14/22] test --- sopel_modules/SpiceBot/Prerun.py | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index 066cce3..df3df87 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -118,19 +118,7 @@ def prerun_query(t_command_type='module', t_command_subtype=None): argsdict_default["realcomref"] = "nickname_query" - argsdict_default["dict"] = { - "author": "deathbybandaid", - "contributors": [], - "example": "", - "exampleresponse": "", - "description": "", - "privs": [], - "filename": "", - "filepath": "", - "foldername": "", - "folderpath": "", - "validcoms": [], - } + argsdict_default["dict"] = botcommands.get_command_dict("query", 'nickname') # split into && groupings and_split = trigger_and_split(trigger_args) From 1d731f500af559942be8dad1b2a3f21de9ad581b Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Thu, 27 Jun 2019 12:25:14 -0400 Subject: [PATCH 15/22] test --- sopel_modules/SpiceBot/Prerun.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index df3df87..b4a80bc 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -105,8 +105,8 @@ def prerun_query(t_command_type='module', t_command_subtype=None): # Argsdict Defaults argsdict_default = {} - argsdict_default["type"] = 'nickname' - argsdict_default["com"] = "query" + argsdict_default["type"] = trigger_command_type + argsdict_default["com"] = trigger_command # messagelog ID argsdict_default["log_id"] = botmessagelog.messagelog_assign() From 99122a819b1c77e3d867ddb0abe2e25a8516c6e0 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Thu, 27 Jun 2019 12:28:44 -0400 Subject: [PATCH 16/22] test --- sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py b/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py index c335c64..a9bb53a 100644 --- a/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py +++ b/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py @@ -20,7 +20,7 @@ def query_trigger(bot, trigger): @SpiceBot.events.check_ready([SpiceBot.events.BOT_COMMANDS]) @SpiceBot.prerun_query('nickname', 'nickname') -@sopel.module.nickname_commands('(.*)') +@sopel.module.nickname_commands('^\?(.*)') def query_detection_nick(bot, trigger): # command issued, check if valid From 363777987d9d6129ba87de564a2ee100cd4d5253 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Thu, 27 Jun 2019 12:36:57 -0400 Subject: [PATCH 17/22] test --- sopel_modules/SpiceBot/Prerun.py | 16 +++++++++++++--- .../SpiceBot_Core_Commands/CommandsQuery.py | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index b4a80bc..06962df 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -29,7 +29,10 @@ def prerun(t_command_type='module', t_command_subtype=None): 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) + trigger_args, trigger_command, trigger_prefix = make_trigger_args(trigger.args[1], trigger_command_type) + + if trigger_prefix == "?": + return trigger_command_type = botcommands.find_command_type(trigger_command) if not trigger_command_type: @@ -101,7 +104,10 @@ def prerun_query(t_command_type='module', t_command_subtype=None): 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) + trigger_args, trigger_command, trigger_prefix = make_trigger_args(trigger.args[1], trigger_command_type) + + if trigger_prefix != "?": + return # Argsdict Defaults argsdict_default = {} @@ -151,12 +157,16 @@ def prerun_query(t_command_type='module', t_command_subtype=None): def make_trigger_args(triggerargs_one, trigger_command_type='module'): trigger_args = spicemanip.main(triggerargs_one, 'create') if trigger_command_type in ['nickname']: + trigger_prefix = spicemanip.main(trigger_args, 2).lower()[0] + if trigger_prefix.isupper() or trigger_prefix.islower(): + trigger_prefix = None trigger_command = spicemanip.main(trigger_args, 2).lower() trigger_args = spicemanip.main(trigger_args, '3+', 'list') else: + trigger_prefix = spicemanip.main(trigger_args, 1).lower()[0] trigger_command = spicemanip.main(trigger_args, 1).lower()[1:] trigger_args = spicemanip.main(trigger_args, '2+', 'list') - return trigger_args, trigger_command + return trigger_args, trigger_command, trigger_prefix def trigger_and_split(trigger_args): diff --git a/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py b/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py index a9bb53a..c335c64 100644 --- a/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py +++ b/sopel_modules/SpiceBot_Core_Commands/CommandsQuery.py @@ -20,7 +20,7 @@ def query_trigger(bot, trigger): @SpiceBot.events.check_ready([SpiceBot.events.BOT_COMMANDS]) @SpiceBot.prerun_query('nickname', 'nickname') -@sopel.module.nickname_commands('^\?(.*)') +@sopel.module.nickname_commands('(.*)') def query_detection_nick(bot, trigger): # command issued, check if valid From bbd36f95130eb2dad59e0046e9396553b8914151 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Thu, 27 Jun 2019 12:45:59 -0400 Subject: [PATCH 18/22] attempt --- sopel_modules/SpiceBot/Prerun.py | 17 +++++++++++++++-- sopel_modules/SpiceBot_Core_Commands/AI.py | 4 ++-- .../SpiceBot_Core_Commands/CommandsQuery.py | 4 ++-- 3 files changed, 19 insertions(+), 6 deletions(-) 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']): From a4f07f4ebe04bcc1ee7ba0a5a1518711688b9184 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Thu, 27 Jun 2019 12:49:43 -0400 Subject: [PATCH 19/22] fix ai --- sopel_modules/SpiceBot_Core_Commands/AI.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sopel_modules/SpiceBot_Core_Commands/AI.py b/sopel_modules/SpiceBot_Core_Commands/AI.py index beeb62f..310fca8 100644 --- a/sopel_modules/SpiceBot_Core_Commands/AI.py +++ b/sopel_modules/SpiceBot_Core_Commands/AI.py @@ -53,7 +53,7 @@ def bot_command_rule_ai(bot, trigger): if str(message).lower().startswith(str(bot.nick).lower()): command_type = 'nickname' - trigger_args, trigger_command = SpiceBot.make_trigger_args(message, 'nickname') + trigger_args, trigger_command, trigger_prefix = 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(bot.config.SpiceBot_Commands.query_prefix): @@ -67,7 +67,7 @@ def bot_command_rule_ai(bot, trigger): return elif str(message).startswith(tuple(bot.config.core.prefix_list)): command_type = 'module' - trigger_args, trigger_command = SpiceBot.make_trigger_args(message, 'module') + trigger_args, trigger_command, trigger_prefix = SpiceBot.make_trigger_args(message, 'module') trigger_args.insert(0, trigger_command) fulltrigger = spicemanip.main(trigger_args, 0) # patch for people typing "...", maybe other stuff, but this verifies that there is still a command here From e08b528974f7fb4c167c32ca11b55ce14d0f02a3 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Thu, 27 Jun 2019 13:02:35 -0400 Subject: [PATCH 20/22] test --- sopel_modules/SpiceBot/Prerun.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index 045222f..df95c89 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -27,8 +27,10 @@ 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 + if t_command_type == "nickname": + check_nick = spicemanip.main(trigger.args[1], 1).lower() + if check_nick != str(bot.nick).lower(): + return else: if not str(trigger.args[1]).startswith(tuple(botconfig.core.prefix_list)): return @@ -105,8 +107,10 @@ 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 + if t_command_type == "nickname": + check_nick = spicemanip.main(trigger.args[1], 1).lower() + if check_nick != str(bot.nick).lower(): + return else: if not str(trigger.args[1]).startswith(tuple(botconfig.core.prefix_list)): return From 3c36c2b7c142cb037041309ddc6768596ad8464e Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Thu, 27 Jun 2019 15:56:21 -0400 Subject: [PATCH 21/22] test --- sopel_modules/SpiceBot/Prerun.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index df95c89..a8d9d31 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -121,7 +121,10 @@ def prerun_query(t_command_type='module', t_command_subtype=None): 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) + prefixnick = False + if t_command_type == "nickname": + prefixnick = True + trigger_args, trigger_command, trigger_prefix = make_trigger_args(trigger.args[1], trigger_command_type, prefixnick) if trigger_prefix != botconfig.SpiceBot_Commands.query_prefix: return @@ -171,13 +174,16 @@ def prerun_query(t_command_type='module', t_command_subtype=None): return actual_decorator -def make_trigger_args(triggerargs_one, trigger_command_type='module'): +def make_trigger_args(triggerargs_one, trigger_command_type='module', prefixnick=False): trigger_args = spicemanip.main(triggerargs_one, 'create') if trigger_command_type in ['nickname']: trigger_prefix = spicemanip.main(trigger_args, 2).lower()[0] if trigger_prefix.isupper() or trigger_prefix.islower(): trigger_prefix = None - trigger_command = spicemanip.main(trigger_args, 2).lower() + if not prefixnick: + trigger_command = spicemanip.main(trigger_args, 2).lower() + else: + trigger_command = spicemanip.main(trigger_args, 2).lower()[1:] trigger_args = spicemanip.main(trigger_args, '3+', 'list') else: trigger_prefix = spicemanip.main(trigger_args, 1).lower()[0] From f983eca8ae7c22a94c0b45aae89f3a22ccac7812 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Thu, 27 Jun 2019 16:00:35 -0400 Subject: [PATCH 22/22] test --- sopel_modules/SpiceBot/Prerun.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index a8d9d31..df95c89 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -121,10 +121,7 @@ def prerun_query(t_command_type='module', t_command_subtype=None): trigger_command_type = str(t_command_type) # Primary command used for trigger, and a list of all words - prefixnick = False - if t_command_type == "nickname": - prefixnick = True - trigger_args, trigger_command, trigger_prefix = make_trigger_args(trigger.args[1], trigger_command_type, prefixnick) + trigger_args, trigger_command, trigger_prefix = make_trigger_args(trigger.args[1], trigger_command_type) if trigger_prefix != botconfig.SpiceBot_Commands.query_prefix: return @@ -174,16 +171,13 @@ def prerun_query(t_command_type='module', t_command_subtype=None): return actual_decorator -def make_trigger_args(triggerargs_one, trigger_command_type='module', prefixnick=False): +def make_trigger_args(triggerargs_one, trigger_command_type='module'): trigger_args = spicemanip.main(triggerargs_one, 'create') if trigger_command_type in ['nickname']: trigger_prefix = spicemanip.main(trigger_args, 2).lower()[0] if trigger_prefix.isupper() or trigger_prefix.islower(): trigger_prefix = None - if not prefixnick: - trigger_command = spicemanip.main(trigger_args, 2).lower() - else: - trigger_command = spicemanip.main(trigger_args, 2).lower()[1:] + trigger_command = spicemanip.main(trigger_args, 2).lower() trigger_args = spicemanip.main(trigger_args, '3+', 'list') else: trigger_prefix = spicemanip.main(trigger_args, 1).lower()[0]