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
nonce
andenforce_nonce
toSendMixin
.]- There's also a basic check to make sure
nonce
has a value whenenable_nonce
is enabled.
- There's also a basic check to make sure
- Add those two properties to
process_message_payload
to 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-commit
code 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