@@ -380,12 +380,52 @@ async def on_timeout(self) -> None:
380380 item .disabled = True
381381 await self .message .edit (view = self )
382382
383- async def disable (self ) -> None :
384- """Stops the paginator, disabling all of its components. Does not disable components added via custom views."""
383+ async def disable (
384+ self ,
385+ include_custom : bool = False ,
386+ page : Optional [Union [str , Union [List [discord .Embed ], discord .Embed ]]] = None ,
387+ ) -> None :
388+ """Stops the paginator, disabling all of its components.
389+
390+ Parameters
391+ ----------
392+ include_custom: :class:`bool`
393+ Whether to disable components added via custom views.
394+ page: Optional[Union[:class:`str`, Union[List[:class:`discord.Embed`], :class:`discord.Embed`]]]
395+ The page content to show after disabling the paginator.
396+ """
385397 for item in self .children :
386- if item not in self .custom_view_items :
398+ if item not in self .custom_view_items or include_custom :
387399 item .disabled = True
388- await self .message .edit (view = self )
400+
401+ await self .message .edit (
402+ content = page if isinstance (page , str ) else None ,
403+ embeds = [] if isinstance (page , str ) else page ,
404+ view = self ,
405+ )
406+
407+ async def cancel (
408+ self ,
409+ include_custom : bool = False ,
410+ page : Optional [Union [str , Union [List [discord .Embed ], discord .Embed ]]] = None ,
411+ ) -> None :
412+ """Cancels the paginator, removing all of its components from the message.
413+
414+ Parameters
415+ ----------
416+ include_custom: :class:`bool`
417+ Whether to remove components added via custom views.
418+ page: Optional[Union[:class:`str`, Union[List[:class:`discord.Embed`], :class:`discord.Embed`]]]
419+ The page content to show after canceling the paginator.
420+ """
421+ for item in self .children :
422+ if item not in self .custom_view_items or include_custom :
423+ self .remove_item (item )
424+ await self .message .edit (
425+ content = page if isinstance (page , str ) else None ,
426+ embeds = [] if isinstance (page , str ) else page ,
427+ view = self ,
428+ )
389429
390430 async def goto_page (self , page_number = 0 ) -> discord .Message :
391431 """Updates the paginator message to show the specified page number.
0 commit comments