disnake
disnake copied to clipboard
New components features
Summary
I just decided to improve the interface of View. I did some useful things for myself and decided to add them.
Changes:
Some methods of View now returns self for chained usage.
Example:
view = (
View(...)
.add_item(...)
.add_item(...)
)
Added Keyboard view with some useful features.
Example:
view = (
Keyboard(timeout=999)
.add_row(awesome_button1, awesome_button2)
.from_iterables(
(b1, b2),
(b3, b4),
start=1
)
)
Checklist
- [x] If code changes were made, then they have been tested
- [ ] I have updated the documentation to reflect the changes
- [x] I have formatted the code properly by running
pre-commit run --all-files
- [ ] This PR fixes an issue
- [x] This PR adds something new (e.g. new method or parameters)
- [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)
- [ ] This PR is not a code change (e.g. documentation, README, ...)
P.S.: Im not sure about docstrings.
Why do the new methods have to be in Keyboard instead of View?
Why do the new methods have to be in
Keyboardinstead ofView?
Just separated them so as not mix with general methods.
Thank you for the PR. At this time we don't plan on implementing a Keyboard-like type or methods, they can easily be implemented by subclassing View in user code and using that as the base class for all views, as they just build on top of the existing view interface.