pycord
pycord copied to clipboard
feat: implement positional flags
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.
- [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, typehinting, examples, ...).
Checklist
- [X] I have searched the open pull requests for duplicates.
- [X] If code changes were made then they have been tested.
- [X] I have updated the documentation to reflect the changes.
- [ ] If
type: ignorecomments were used, a comment is also left explaining why. - [X] I have updated the changelog to include these changes.
@Vioshim please work on dorus comment and resolve conflcts