Visitar URL original
Improvements for message.command by mendelmaleh · Pull Request #292 · pyrogram/pyrogram · GitHub
The Wayback Machine - https://web.archive.org/web/20201210054425/https://github.com/pyrogram/pyrogram/pull/292
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements for message.command #292

Merged
merged 6 commits into from Aug 9, 2019
Merged

Conversation

@mendelmaleh
Copy link
Contributor

@mendelmaleh mendelmaleh commented Jul 29, 2019

Enables easier and standard parsing, for quote wrapped args, etc.
Filters.command now has a posix argument, and the separator argument was
removed. shlex.split() works similar to having before separator=None.

Enables easier and standard parsing, for quote wrapped args, etc.
Filters.command now has a posix argument, and the separator argument was
removed. shlex.split() works similar to having before separator=None.
@mendelmaleh mendelmaleh force-pushed the mendelmaleh:shlex_split branch from b7e9c43 to 584a6a0 Jul 29, 2019
mendelmaleh and others added 2 commits Jul 30, 2019
- Removed "posix" parameter because we only want posix=True and the filter becomes simpler.
- Figured out how to deal with single backslashes ("\") errors.
- Refactor the whole filter: use better names for identifiers.
- Rename parameter "prefix" to "prefixes".
@delivrance
Copy link
Member

@delivrance delivrance commented Jul 31, 2019

As we discussed in the group, I've updated the filter. We still have the issue about unmatched quotes, though.

mendelmaleh and others added 3 commits Aug 7, 2019
- Use regex for case sensitivity
- Less indentation
- Ensure that the command returned is the correct case
- Ensure that if the command has more text, it is split by whitespace
- Remove negative lookahead to fix "\"" reporting commas
- Escape cmd when interpolating the pattern
- Remove the escape character from the arguments
- Return True when a valid command is found, return False at the end
@mendelmaleh mendelmaleh changed the title Use shlex.split() for message.command Improvements for message.command Aug 9, 2019
@delivrance delivrance merged commit 7280055 into pyrogram:develop Aug 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.