21
21
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22
22
DEALINGS IN THE SOFTWARE.
23
23
"""
24
- import copy
25
24
from typing import Dict , List , Optional , Union
26
25
27
26
import discord
@@ -274,7 +273,6 @@ def __init__(
274
273
self .default_button_row = default_button_row
275
274
self .loop_pages = loop_pages
276
275
self .custom_view = custom_view
277
- self .custom_view_items = []
278
276
self .message : Union [discord .Message , discord .WebhookMessage , None ] = None
279
277
280
278
if self .custom_buttons and not self .use_default_buttons :
@@ -395,6 +393,7 @@ async def disable(
395
393
page: Optional[Union[:class:`str`, Union[List[:class:`discord.Embed`], :class:`discord.Embed`]]]
396
394
The page content to show after disabling the paginator.
397
395
"""
396
+ page = self .get_page_content (page )
398
397
for item in self .children :
399
398
if item not in self .custom_view_items or include_custom :
400
399
item .disabled = True
@@ -421,9 +420,10 @@ async def cancel(
421
420
page: Optional[Union[:class:`str`, Union[List[:class:`discord.Embed`], :class:`discord.Embed`]]]
422
421
The page content to show after canceling the paginator.
423
422
"""
424
- items = copy .copy (self .children )
423
+ items = self .children .copy ()
424
+ page = self .get_page_content (page )
425
425
for item in items :
426
- if item not in self .custom_view_items or include_custom :
426
+ if item not in self .custom_view . children or include_custom :
427
427
self .remove_item (item )
428
428
if page :
429
429
await self .message .edit (
@@ -613,9 +613,7 @@ def update_buttons(self) -> Dict:
613
613
# The bot developer should handle row assignments for their view before passing it to Paginator
614
614
if self .custom_view :
615
615
for item in self .custom_view .children :
616
- self .custom_view_items .append (item )
617
616
self .add_item (item )
618
-
619
617
return self .buttons
620
618
621
619
@staticmethod
0 commit comments