Skip to content

Conversation

@Vioshim
Copy link
Contributor

@Vioshim Vioshim commented Apr 30, 2024

Summary

This allows FlagConverters to be used after the first text expression, for example

class HandleText(FlagConverter, prefix="--", delimiter=" "):
    text: str = commands.flag(positional=True)
    flip: bool = False
    
@bot.bridge_command()
async def welcome(ctx: bridge.BridgeContext, *, flags: HandleText):
    text = flags.text[::-1] if flags.flip else flags.text
    await ctx.respond(text)

# ?welcome Hello world
# ?welcome Hello world --flip True
# ?welcome --text Hello world
# ?welcome --text Hello world --flip True

Information

  • 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, typehinting,
    examples, ...).

Checklist

  • I have searched the open pull requests for duplicates.
  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • If type: ignore comments were used, a comment is also left explaining why.
  • I have updated the changelog to include these changes.

@JustaSqu1d JustaSqu1d added hold: documentation This pull request is missing documentation hold: changelog This pull request is missing a changelog entry labels Apr 30, 2024
@JustaSqu1d JustaSqu1d removed the hold: changelog This pull request is missing a changelog entry label May 22, 2024
@Dorukyum Dorukyum changed the title feat: Implements positional flags feat: implement positional flags Jun 28, 2024
Co-authored-by: Dorukyum <[email protected]>
Co-authored-by: JustaSqu1d <[email protected]>
Signed-off-by: Lala Sabathil <[email protected]>
@Lulalaby
Copy link
Member

Lulalaby commented Jul 1, 2024

@Vioshim please work on dorus comment and resolve conflcts

@JustaSqu1d JustaSqu1d added priority: medium Medium Priority feature Implements a feature python Pull requests that update Python code and removed hold: documentation This pull request is missing documentation labels Aug 7, 2024
@Lulalaby Lulalaby added this to the v2.7 milestone Aug 10, 2024
Lulalaby and others added 6 commits August 16, 2024 14:52
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.
@Paillat-dev
Copy link
Member

Needs testing + doesn't work with python 3.11+

@Lulalaby
Copy link
Member

Lulalaby commented Aug 2, 2025

Merge conflicts

@Paillat-dev
Copy link
Member

@Lulalaby I think that OP is gone but I can fix these in a new pr. Lmk if ok

@Lulalaby
Copy link
Member

Lulalaby commented Aug 2, 2025

Sure go for it if you still think it's a good addition

@Vioshim
Copy link
Contributor Author

Vioshim commented Aug 4, 2025

My apologies, felt lost on how to be able to contribute in the project once i saw the things about merging conflicts or the documentation changes, so ended up lost on how to correct it alongside irl stuff, so my apologies for the lack of response

@Paillat-dev
Copy link
Member

@Vioshim no worries. Do you still want to work on this ? If lmk and I'll handle the merge conflicts and the rest

@Vioshim
Copy link
Contributor Author

Vioshim commented Aug 4, 2025

That'd be quite appreciated, thank you!!
@Paillat-dev

@Paillat-dev
Copy link
Member

No worries and thank you for your contribution !

@Paillat-dev
Copy link
Member

Paillat-dev commented Aug 4, 2025

@Lumabots Can I get some testing from you ? Specifically on python 3.11 and higher ?

@Lumabots
Copy link
Contributor

Lumabots commented Aug 4, 2025

@Lumabots Can I get some testing from you ? Specifically on python 3.11 and higher ?

Yep doing that tomorrow evening

@Lulalaby Lulalaby requested a review from a team as a code owner August 30, 2025 20:33
@Lulalaby Lulalaby force-pushed the master branch 2 times, most recently from b55c125 to 82659b2 Compare August 30, 2025 21:10
@Lulalaby Lulalaby removed the on hold label Aug 30, 2025
@Lulalaby Lulalaby requested a review from a team as a code owner September 1, 2025 12:31
Copy link
Contributor

@DA-344 DA-344 left a comment

Choose a reason for hiding this comment

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

lgtm code wise, if this is tested and works then should be ready to merge

Copy link
Contributor

@Lumabots Lumabots left a comment

Choose a reason for hiding this comment

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

lgtm, tested with py11, 12, 13

@Lulalaby
Copy link
Member

Damn one year old already

@Lulalaby Lulalaby dismissed stale reviews from Dorukyum and JustaSqu1d October 21, 2025 09:01

A

@Lulalaby Lulalaby merged commit 9f265b0 into Pycord-Development:master Oct 21, 2025
27 of 28 checks passed
Paillat-dev pushed a commit to Pycord-Development/pycord-next that referenced this pull request Oct 26, 2025
* Implements positional flags

* style(pre-commit): auto fixes from pre-commit.com hooks

* Documentation for positional argument in commands.Flag

* style(pre-commit): auto fixes from pre-commit.com hooks

* Apply suggestions from code review

Co-authored-by: Dorukyum <[email protected]>
Co-authored-by: JustaSqu1d <[email protected]>
Signed-off-by: Lala Sabathil <[email protected]>

* chore: Update typing import in flags.py

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.

* style(pre-commit): auto fixes from pre-commit.com hooks

* style(pre-commit): auto fixes from pre-commit.com hooks

* Apply suggestion from @Paillat-dev

Signed-off-by: Paillat <[email protected]>

---------

Signed-off-by: Lala Sabathil <[email protected]>
Signed-off-by: Lala Sabathil <[email protected]>
Signed-off-by: Dorukyum <[email protected]>
Signed-off-by: Paillat <[email protected]>
Signed-off-by: Paillat <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Lala Sabathil <[email protected]>
Co-authored-by: Dorukyum <[email protected]>
Co-authored-by: JustaSqu1d <[email protected]>
Co-authored-by: Lala Sabathil <[email protected]>
Co-authored-by: Paillat <[email protected]>
Co-authored-by: Paillat <[email protected]>

(cherry picked from commit 9f265b0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Implements a feature hold: testing This pull request requires further testing priority: low Low Priority python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants