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

Implement support for command argument separators. #2485

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

NCPlayz
Copy link
Contributor

@NCPlayz NCPlayz commented Dec 22, 2019

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 , requiring the use of quotes for multiple word arguments. ?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

  • Fix parentheses in docstrings
  • Use c.isspace instead of hardcoded space check
  • Check if there is an encapsulator -> don't use a hardcoded dict to replace it
  • Validate the objects given as parameters for Separator and Encapsulator.

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • This PR fixes an issue.
  • 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, ...)

@NCPlayz NCPlayz marked this pull request as ready for review December 31, 2019 19:13
Copy link
Owner

@Rapptz Rapptz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mostly fine aside from the questions I poised down there.

I'm going to slate this for 1.4 release so if you could add those versionadded tags I'd be grateful.

discord/ext/commands/core.py Outdated Show resolved Hide resolved
discord/ext/commands/core.py Outdated Show resolved Hide resolved
discord/ext/commands/view.py Show resolved Hide resolved
@Rapptz Rapptz added this to the 1.4 milestone Apr 4, 2020
@Rapptz Rapptz force-pushed the v1/ext/commands/separator branch from 391788a to b35070e Compare July 24, 2020 13:37
discord/ext/commands/core.py Outdated Show resolved Hide resolved
discord/ext/commands/core.py Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants