mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-13 06:59:53 -05:00
fix handling remove redundant hyphen args
This commit is contained in:
parent
63ded5527b
commit
69cea3c0fd
@ -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,18 +437,13 @@ 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"]]:
|
# handling for special cases
|
||||||
botcom.dict["responsekey"] = str(botcom.dict["hyphen_arg"]).lower()
|
posscom = spicemanip(botcom.dict['args'], 1)
|
||||||
|
if posscom.lower() in [command.lower() for command in botcom.dict["dict"]["nonstockoptions"]]:
|
||||||
else:
|
for command in botcom.dict["dict"]["nonstockoptions"]:
|
||||||
|
if command.lower() == posscom.lower():
|
||||||
# handling for special cases
|
posscom = command
|
||||||
posscom = spicemanip(botcom.dict['args'], 1)
|
botcom.dict["responsekey"] = posscom
|
||||||
if posscom.lower() in [command.lower() for command in botcom.dict["dict"]["nonstockoptions"]]:
|
|
||||||
for command in botcom.dict["dict"]["nonstockoptions"]:
|
|
||||||
if command.lower() == posscom.lower():
|
|
||||||
posscom = command
|
|
||||||
botcom.dict["responsekey"] = posscom
|
|
||||||
|
|
||||||
return botcom
|
return botcom
|
||||||
|
|
||||||
@ -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
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user