interactions.py
interactions.py copied to clipboard
feat: add nonce and enforce_nonce to SendMixin
Pull Request Type
- [x] Feature addition
- [ ] Bugfix
- [ ] Documentation update
- [ ] Code refactor
- [ ] Tests improvement
- [ ] CI/CD pipeline enhancement
- [ ] Other: [Replace with a description]
Description
Exactly what the title of the PR says. Technically, SendMixin would have handled these arguments just fine due to the kwarg passthrough here, but having them be more official and documented is nice.
Changes
- Add
nonceandenforce_noncetoSendMixin.]- There's also a basic check to make sure
noncehas a value whenenable_nonceis enabled.
- There's also a basic check to make sure
- Add those two properties to
process_message_payloadto cover all bases.
Related Issues
Resolves #1614.
Test Scenarios
await channel.send("hello!", nonce="test", enforce_nonce=True)
await channel.send("hello!", nonce="test", enforce_nonce=True)
Python Compatibility
- [ ] I've ensured my code works on Python
3.10.x - [x] I've ensured my code works on Python
3.11.x
Checklist
- [x] I've run the
pre-commitcode linter over all edited files - [x] I've tested my changes on supported Python versions
- [ ] I've added tests for my code, if applicable
- [x] I've updated / added documentation, where applicable