Skip to content

feat: option to hide paginator buttons on stop/timeout #1660

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions interactions/ext/paginators.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ class Paginator:
"""Show a button which will call the `callback`"""
show_select_menu: bool = attrs.field(repr=False, default=False)
"""Should a select menu be shown for navigation"""
hide_buttons_on_stop: bool = attrs.field(repr=False, default=False)
"""Should the paginator buttons be hidden instead of disabled after stop or timeout"""

first_button_emoji: Optional[Union["PartialEmoji", dict, str]] = attrs.field(
repr=False, default="⏮️", metadata=export_converter(process_emoji)
Expand Down Expand Up @@ -270,6 +272,9 @@ def create_components(self, disable: bool = False) -> List[ActionRow]:
A list of ActionRows

"""
if disable and self.hide_buttons_on_stop:
return []

output = []

if self.show_select_menu:
Expand Down