interactions.py icon indicating copy to clipboard operation
interactions.py copied to clipboard

feat: add nonce and enforce_nonce to SendMixin

Open AstreaTSS opened this issue 1 year ago • 0 comments

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 and enforce_nonce to SendMixin.]
    • There's also a basic check to make sure nonce has a value when enable_nonce is enabled.
  • 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

AstreaTSS avatar Feb 21 '24 18:02 AstreaTSS