mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-12 14:39:54 -05:00
test last translation
This commit is contained in:
parent
e5f21a1cdd
commit
b7e4bb31f3
@ -404,27 +404,44 @@ def trigger_hyphen_args(trigger_args_part):
|
|||||||
'contribs', 'contrib', "contributors",
|
'contribs', 'contrib', "contributors",
|
||||||
'alias', 'aliases'
|
'alias', 'aliases'
|
||||||
]
|
]
|
||||||
|
numdict = {
|
||||||
|
"last": -1
|
||||||
|
}
|
||||||
hyphen_args = []
|
hyphen_args = []
|
||||||
trigger_args_unhyphend = []
|
trigger_args_unhyphend = []
|
||||||
for worditem in trigger_args_part:
|
for worditem in trigger_args_part:
|
||||||
if str(worditem).startswith("--"):
|
if str(worditem).startswith("--"):
|
||||||
clipped_word = worditem[2:]
|
clipped_word = str(worditem[2:]).lower()
|
||||||
|
|
||||||
|
# valid arg above
|
||||||
if clipped_word in valid_hyphen_args:
|
if clipped_word in valid_hyphen_args:
|
||||||
hyphen_args.append(clipped_word)
|
hyphen_args.append(clipped_word)
|
||||||
|
|
||||||
|
# numbered args
|
||||||
elif str(clipped_word).isdigit():
|
elif str(clipped_word).isdigit():
|
||||||
hyphen_args.append(int(clipped_word))
|
hyphen_args.append(int(clipped_word))
|
||||||
|
elif clipped_word in list(numdict.keys()):
|
||||||
|
hyphen_args.append(int(numdict[clipped_word]))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
|
# check if arg word is a number
|
||||||
try:
|
try:
|
||||||
clipped_word = w2n.word_to_num(str(clipped_word))
|
clipped_word = w2n.word_to_num(str(clipped_word))
|
||||||
hyphen_args.append(int(clipped_word))
|
hyphen_args.append(int(clipped_word))
|
||||||
|
|
||||||
|
# word is not a valid arg or number
|
||||||
except ValueError:
|
except ValueError:
|
||||||
trigger_args_unhyphend.append(worditem)
|
trigger_args_unhyphend.append(worditem)
|
||||||
else:
|
else:
|
||||||
trigger_args_unhyphend.append(worditem)
|
trigger_args_unhyphend.append(worditem)
|
||||||
|
|
||||||
|
# only one arg allowed per && split
|
||||||
if len(hyphen_args):
|
if len(hyphen_args):
|
||||||
hyphenarg = hyphen_args[0]
|
hyphenarg = hyphen_args[0]
|
||||||
else:
|
else:
|
||||||
hyphenarg = None
|
hyphenarg = None
|
||||||
|
|
||||||
return trigger_args_unhyphend, hyphenarg
|
return trigger_args_unhyphend, hyphenarg
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user