-
-
Notifications
You must be signed in to change notification settings - Fork 474
feat: implement positional flags #2443
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: Dorukyum <53639936+Dorukyum@users.noreply.github.com> Co-authored-by: JustaSqu1d <89910983+JustaSqu1d@users.noreply.github.com> Signed-off-by: Lala Sabathil <aiko@aitsys.dev>
@Vioshim please work on dorus comment and resolve conflcts |
Signed-off-by: Lala Sabathil <lala@pycord.dev>
The typing import in flags.py has been updated to include the Optional module. This change ensures that the __commands_flag_positional__ attribute can accept a value of None.
Signed-off-by: Dorukyum <53639936+Dorukyum@users.noreply.github.com>
I have no idea how this works, but if the only thing stopping it from getting merged are conflicts, I can sure resolve those. |
Signed-off-by: Lala Sabathil <lala@pycord.dev>
Signed-off-by: Dorukyum <53639936+Dorukyum@users.noreply.github.com>
@Pycord-Development/contributors can we get some testing here :D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File "C:\Users\Jérémie\Documents\GitHub\pycord\thing.py", line 23, in <module>
class BasicText(FlagConverter, prefix="--", delimiter=" "):
File "C:\Users\Jérémie\Documents\GitHub\pycord\thing.py", line 24, in BasicText
text: str = flag(positional=True)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Jérémie\Documents\GitHub\pycord\discord\ext\commands\flags.py", line 143, in flag
return Flag(
^^^^^
TypeError: Flag.__init__() got an unexpected keyword argument 'name'
The error does not seem to be caused by this PR, but rather by me using python 3.11
. The error is not present in my testing when using python 3.10
.
fix in #2759
Other than that, this seems to work to me, although I don't think I'm experienced enough with flags - and prefixed commands to assess with good certainty that everything works as expected.
does this need testing or is it ready to merge ? |
Needs testing + doesn't work with python 3.11+ |
Summary
This allows FlagConverters to be used after the first text expression, for example
Information
examples, ...).
Checklist
type: ignore
comments were used, a comment is also left explaining why.