-
-
Notifications
You must be signed in to change notification settings - Fork 478
Labels
bugSomething isn't workingSomething isn't working
Description
Initializing Paginator with show_menu=False throws an undocumented error when all the pages are PageGroup objects
Minimal reproducible example:
from discord.ext.pages import Paginator, PageGroup
Paginator(pages=[PageGroup(["a","b"], "label")])Resulting error:
File "c:\temp\bot\src\help.py", line 49, in get_help_paginator
Paginator(pages=[PageGroup(["a","b"], "label")])
File "C:\temp\bot\.venv\Lib\site-packages\discord\ext\pages\pagination.py", line 412, in __init__
if all(isinstance(pg, PageGroup) for pg in pages):
^^^^^
TypeError: 'NoneType' object is not iterable
Caused by this line
pycord/discord/ext/pages/pagination.py
Lines 420 to 422 in 54f6576
| if all(isinstance(pg, PageGroup) for pg in pages): | |
| self.page_groups = self.pages if show_menu else None | |
| if sum(pg.default is True for pg in self.page_groups) > 1: |
If show_menu is false (dafault argument for the Paginator), line 422 tries to iterate over the None assigned in line 421.
Expected behavior should be following, based on the Paginator docstring.
If a list of :class:`PageGroup` objects is provided and `show_menu` is ``False``, only the first page group will be displayed.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working