NAFF
NAFF copied to clipboard
feat: add hybrid commands
What type of pull request is this?
- [x] Non-breaking code change
- [ ] Breaking code change
- [x] Documentation change/addition
- [ ] Tests change
Description
This PR adds hybrid commands, which allow using a slash command as a prefixed command too. Efforts have been taken to make sure the resulting prefixed command is as close to the slash command as possible.
This PR also, mostly by consequence:
- Adds in
HybridContext
. An argument has been added toClient
to allow setting a custom subclass ofHybridContext
, too. - Allows using custom signatures for prefixed commands. This is a very low level thing and should only be manipulated by those who know what they're doing.
- Changes prefixed commands to base if it should use a kwarg for a parameter or not based on its parameter type instead of blindly guessing.
- Adds
kind
toPrefixedCommandParameter
. - Adds docs for hybrid commands.
Due to the many, many ways slash commands can be declared, there may be some bugs that I missed (though I did test a number of combinations and options).
Changes
See above. Usually, I would type something out, but I feel like this would be a repeat of the description if I bothered.
Checklist
- [x] I've formatted my code with Black
- [x] I've ensured my code works on
Python 3.10.x
- [x] I've tested my code
Can you go into tests/test_protocols.py and a check that Hybrid contexts are SendableContexts?
Done!
Due to the scope of this PR it should not be merged until we have at least a second trust-worthy reviewer
That said if it hits 14 days since my review without a second, it'll be merged
Found a little oversight - min/max_length
wasn't being respected. That's been fixed with the latest two commits.