Skip to content

Commit

Permalink
fix checking for paginator components
Browse files Browse the repository at this point in the history
  • Loading branch information
krittick committed Jan 30, 2022
1 parent 132cd05 commit c81355e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion discord/ext/pages/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ def __init__(
self.default_button_row = default_button_row
self.loop_pages = loop_pages
self.custom_view = custom_view
self.custom_view_items = []
self.message: Union[discord.Message, discord.WebhookMessage, None] = None

if self.custom_buttons and not self.use_default_buttons:
Expand Down Expand Up @@ -382,7 +383,7 @@ async def on_timeout(self) -> None:
async def disable(self) -> None:
"""Stops the paginator, disabling all of its components. Does not disable components added via custom views."""
for item in self.children:
if isinstance(item, (PaginatorButton, PaginatorMenu)):
if item not in self.custom_view_items:
item.disabled = True
await self.message.edit(view=self)

Expand Down Expand Up @@ -565,6 +566,7 @@ def update_buttons(self) -> Dict:
# The bot developer should handle row assignments for their view before passing it to Paginator
if self.custom_view:
for item in self.custom_view.children:
self.custom_view_items.append(item)
self.add_item(item)

return self.buttons
Expand Down

0 comments on commit c81355e

Please sign in to comment.