mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
Fix Message.command when case is different (#757)
* Fix Message.command when case is different * Update test_command.py Co-authored-by: Dan <14043624+delivrance@users.noreply.github.com>
This commit is contained in:
parent
fdbab8cc87
commit
02a3969101
2 changed files with 6 additions and 1 deletions
|
|
@ -794,7 +794,8 @@ def command(commands: Union[str, List[str]], prefixes: Union[str, List[str]] = "
|
|||
flags=re.IGNORECASE if not flt.case_sensitive else 0):
|
||||
continue
|
||||
|
||||
without_command = re.sub(rf"{cmd}(?:@?{username})?\s?", "", without_prefix, count=1)
|
||||
without_command = re.sub(rf"{cmd}(?:@?{username})?\s?", "", without_prefix, count=1,
|
||||
flags=re.IGNORECASE if not flt.case_sensitive else 0)
|
||||
|
||||
# match.groups are 1-indexed, group(1) is the quote, group(2) is the text
|
||||
# between the quotes, group(3) is unquoted, whitespace-split text
|
||||
|
|
|
|||
|
|
@ -107,6 +107,10 @@ async def test_with_args():
|
|||
await f(c, m)
|
||||
assert m.command == ["start"]
|
||||
|
||||
m = Message("/StArT")
|
||||
await f(c, m)
|
||||
assert m.command == ["start"]
|
||||
|
||||
m = Message("/start@username")
|
||||
await f(c, m)
|
||||
assert m.command == ["start"]
|
||||
|
|
|
|||
Loading…
Reference in a new issue