fix handling remove redundant hyphen args

This commit is contained in:
deathbybandaid 2019-09-19 12:11:06 -04:00
parent 63ded5527b
commit 69cea3c0fd

View File

@ -104,13 +104,13 @@ def prerun(t_command_type='module', t_command_subtype=None):
botcom.dict["args"], botcom.dict["hyphen_arg"] = trigger_hyphen_args(botcom) botcom.dict["args"], botcom.dict["hyphen_arg"] = trigger_hyphen_args(botcom)
# special handling
botcom = special_handling(botcom)
args_pass = trigger_hyphen_arg_handler(bot, trigger, botcom) args_pass = trigger_hyphen_arg_handler(bot, trigger, botcom)
if args_pass: if args_pass:
# special handling
botcom = special_handling(botcom)
if trigger_runstatus(bot, trigger, botcom): if trigger_runstatus(bot, trigger, botcom):
function(bot, trigger, botcom, *args, **kwargs) function(bot, trigger, botcom, *args, **kwargs)
botmessagelog.messagelog_exit(bot, argsdict_default["log_id"]) botmessagelog.messagelog_exit(bot, argsdict_default["log_id"])
@ -437,11 +437,6 @@ def trigger_cant_run(bot, trigger, botcom, message=None):
def special_handling(botcom): def special_handling(botcom):
botcom.dict["responsekey"] = "?default" botcom.dict["responsekey"] = "?default"
if str(botcom.dict["hyphen_arg"]).lower() in [command.lower() for command in botcom.dict["dict"]["nonstockoptions"]]:
botcom.dict["responsekey"] = str(botcom.dict["hyphen_arg"]).lower()
else:
# handling for special cases # handling for special cases
posscom = spicemanip(botcom.dict['args'], 1) posscom = spicemanip(botcom.dict['args'], 1)
if posscom.lower() in [command.lower() for command in botcom.dict["dict"]["nonstockoptions"]]: if posscom.lower() in [command.lower() for command in botcom.dict["dict"]["nonstockoptions"]]:
@ -465,10 +460,6 @@ def trigger_hyphen_args(botcom):
if clipped_word in prerun_shared.valid_hyphen_args: if clipped_word in prerun_shared.valid_hyphen_args:
hyphen_args.append(clipped_word) hyphen_args.append(clipped_word)
# include nonstock options here as well
elif str(clipped_word).lower() in [command.lower() for command in botcom.dict["dict"]["nonstockoptions"]]:
hyphen_args.append(clipped_word)
# numbered args # numbered args
elif str(clipped_word).isdigit(): elif str(clipped_word).isdigit():
hyphen_args.append(int(clipped_word)) hyphen_args.append(int(clipped_word))
@ -505,10 +496,6 @@ def trigger_hyphen_arg_handler(bot, trigger, botcom):
if not botcom.dict["hyphen_arg"]: if not botcom.dict["hyphen_arg"]:
return True return True
# include nonstock options here as well
elif str(botcom.dict["hyphen_arg"]).lower() in [command.lower() for command in botcom.dict["dict"]["nonstockoptions"]]:
return True
# handle numbered args # handle numbered args
elif str(botcom.dict["hyphen_arg"]).isdigit() or botcom.dict["hyphen_arg"] in [-1, 'random']: elif str(botcom.dict["hyphen_arg"]).isdigit() or botcom.dict["hyphen_arg"] in [-1, 'random']:
return True return True