From e9a9c236cbf30bd717b3df1d5cfd86df53581698 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Thu, 23 May 2019 20:28:01 -0400 Subject: [PATCH] --check --- sopel_modules/SpiceBot/Prerun.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index d22005e..94287bf 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -55,14 +55,12 @@ class BotPrerun(): for argsdict in argsdict_list: trigger.sb = argsdict trigger.sb["args"], trigger.sb["hyphen_arg"] = self.trigger_hyphen_args(trigger.sb["args"]) - # if trigger.sb["hyphen_arg"]: - # self.trigger_hyphen_arg_handler(bot, trigger) - # else: - # # check if anything prohibits the nick from running the command - # if self.trigger_runstatus(bot, trigger, argsdict): - # function(bot, trigger, *args, **kwargs) - if self.trigger_runstatus(bot, trigger, argsdict): - function(bot, trigger, *args, **kwargs) + if not trigger.sb["hyphen_arg"]: + # check if anything prohibits the nick from running the command + if self.trigger_runstatus(bot, trigger, argsdict): + function(bot, trigger, *args, **kwargs) + else: + self.trigger_hyphen_arg_handler(bot, trigger) return return internal_prerun return actual_decorator @@ -113,7 +111,14 @@ class BotPrerun(): def trigger_hyphen_arg_handler(self, bot, trigger): # Commands that cannot run via privmsg - if trigger.sb["hyphen_arg"] in ['enable']: + if trigger.sb["hyphen_arg"] in ['check']: + if trigger.sb["com"].lower() != trigger.sb["realcom"]: + bot.say(trigger.sb["com"] + " is a valid alias command for " + trigger.sb["realcom"]) + else: + bot.say(trigger.sb["com"] + " is a valid command") + return + + elif trigger.sb["hyphen_arg"] in ['enable']: if not command_permissions_check(bot, trigger, ['admins', 'owner', 'OP', 'ADMIN', 'OWNER']): bot.say("I was unable to disable this command due to privilege issues.")