mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-28 21:07:59 +00:00
Call shlex.split() only after validating cmd, try/except it.
This commit is contained in:
parent
584a6a046a
commit
b4cdf1900c
@ -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…
x
Reference in New Issue
Block a user