discord.py
discord.py copied to clipboard
Implement support for command argument separators.
Summary
This is an adaptation of the now defunct PR - #645. It allows for two ways of command customization:
- Separator: Essentially lets you separate the arguments using something other than
?foo a b, c, d, e
->('a b', 'c', 'd', 'e')
- Encapsulator: Another way of using quotes.
?bar a b [c d e] f g
->('a', 'b', 'c d e', 'f', 'g')
As this changes quite a bit of the parsing of commands behind the scenes, I will try to test this as extensively as possible before marking it ready for review.
Improvement list
- [x] Fix parentheses in docstrings
- [x] Use
c.isspace
instead of hardcoded space check - [x] Check if there is an encapsulator -> don't use a hardcoded dict to replace it
- [x] Validate the objects given as parameters for Separator and Encapsulator.
Checklist
- [x] If code changes were made then they have been tested.
- [x] I have updated the documentation to reflect the changes.
- [ ] This PR fixes an issue.
- [x] This PR adds something new (e.g. new method or parameters).
- [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)
- [ ] This PR is not a code change (e.g. documentation, README, ...)