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

add deactivate_buttons() to Paginators

Open Donbur4156 opened this issue 1 year ago • 3 comments

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

  1. create Paginator
  2. activate Select Menu
  3. deactivate Buttons via function
  4. 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.x not testet with 3.11, but changes should not break this.

Checklist

  • [ ] I've run the pre-commit code 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

Donbur4156 avatar May 12 '24 20:05 Donbur4156

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.

AstreaTSS avatar May 12 '24 20:05 AstreaTSS

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.

mifuyutsuki avatar May 13 '24 07:05 mifuyutsuki

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.

Donbur4156 avatar May 13 '24 19:05 Donbur4156