interactions.py
interactions.py copied to clipboard
add deactivate_buttons() to Paginators
Pull Request Type
- [X] Feature addition
- [ ] Bugfix
- [ ] Documentation update
- [ ] Code refactor
- [ ] Tests improvement
- [ ] CI/CD pipeline enhancement
- [ ] Other: [Replace with a description]
Description
add function to deactivate Control Buttons in a Paginator. To reduce 5 Lines of Code to 2 to switch from Buttons to select.
Changes
- add function "deactivate_buttons()" to Paginator Class
Related Issues
#1681
Test Scenarios
- create Paginator
- activate Select Menu
- deactivate Buttons via function
- send Paginator
Python Compatibility
- [X] I've ensured my code works on Python
3.10.x - [ ] I've ensured my code works on Python
3.11.xnot testet with 3.11, but changes should not break this.
Checklist
- [ ] I've run the
pre-commitcode linter over all edited files - [ ] I've tested my changes on supported Python versions
- [ ] I've added tests for my code, if applicable
- [ ] I've updated / added documentation, where applicable
I'm... not actually sure if this is really useful, honestly. This seems like a niche usecase that isn't done terribly often, and it's only a few lines of code.
If the purpose of this feature is to change a few default attributes... Yeah, I don't think it warrants creating a whole method. And the method name deactivate_buttons() itself appears like it's meant to disable the buttons of an already sent paginator, which is the purpose of Paginator.stop().
If you use that "show select menu only" pattern often in your bot code, you might have better luck creating a subclass of Paginator with the relevant attributes overridden. Otherwise, I would be perfectly fine with the extra few lines for explicit readability.
Ok, it was just an idea to simplify the bot code. If you don't want to implement this I would be fine with it and you can close PR and Feature request.