mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-03 14:04:51 +00:00
Call shlex.split() only after validating cmd, try/except it.
This commit is contained in:
parent
584a6a046a
commit
b4cdf1900c
1 changed files with 8 additions and 3 deletions
|
|
@ -246,10 +246,15 @@ class Filters:
|
||||||
if text:
|
if text:
|
||||||
for p in flt.p:
|
for p in flt.p:
|
||||||
if text.startswith(p):
|
if text.startswith(p):
|
||||||
s = split(text, posix=flt.psx)
|
c = text[len(p):].split(None, 1)[0]
|
||||||
c, a = s[0][len(p):], s[1:]
|
|
||||||
c = c if flt.cs else c.lower()
|
c = c if flt.cs else c.lower()
|
||||||
message.command = ([c] + a) if c in flt.c else None
|
if c not in flt.c:
|
||||||
|
return False
|
||||||
|
try:
|
||||||
|
a = split(text, posix=flt.psx)[1:]
|
||||||
|
message.command = ([c] + a)
|
||||||
|
except ValueError as e:
|
||||||
|
message.command = {"text": text[len(p):], "error": e}
|
||||||
break
|
break
|
||||||
|
|
||||||
return bool(message.command)
|
return bool(message.command)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue