Skip to content

Commit 21357e8

Browse files
committed
un-break the paginator
1 parent d4f13da commit 21357e8

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

core/utils/paginator.py

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,20 @@
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
SOFTWARE.
2222
"""
23-
from __future__ import annotations
24-
2523
import asyncio
2624
from typing import TYPE_CHECKING, Any
2725

2826
import discord
2927
from discord import ui # shortcut because I'm lazy
30-
from discord.ext import commands
28+
from discord.ext.commands import CommandError, Paginator as _Paginator
3129
from discord.utils import MISSING
32-
3330
from core import Context
31+
from typing_extensions import Self
3432

35-
36-
if TYPE_CHECKING:
37-
from typing_extensions import Self
38-
39-
__all__ = (
40-
"CannotPaginate",
41-
"Pager",
42-
"KVPager",
43-
"TextPager",
44-
)
33+
__all__ = ("CannotPaginate", "Pager", "KVPager", "TextPager")
4534

4635

47-
class CannotPaginate(commands.CommandError):
36+
class CannotPaginate(CommandError):
4837
pass
4938

5039

@@ -120,7 +109,7 @@ def get_page(self, page: int) -> list[Any]:
120109
return self.entries[base : base + self.per_page]
121110

122111
def get_content(self, entry: Any, page: int, *, first: bool = False) -> str:
123-
raise NotImplementedError
112+
return None
124113

125114
def get_embed(self, entries: list[Any], page: int, *, first: bool = False):
126115
self.prepare_embed(entries, page, first=first)
@@ -303,7 +292,7 @@ class TextPager(Pager):
303292
def __init__(
304293
self, ctx: Context, text: str, *, prefix: str = "```", suffix: str = "```", max_size: int = 2000, stop: bool = False
305294
) -> None:
306-
paginator = commands.Paginator(prefix=prefix, suffix=suffix, max_size=max_size - 200)
295+
paginator = _Paginator(prefix=prefix, suffix=suffix, max_size=max_size - 200)
307296
for line in text.split("\n"):
308297
paginator.add_line(line)
309298

@@ -313,7 +302,7 @@ def get_page(self, page: int) -> Any:
313302
return self.entries[page - 1]
314303

315304
def get_embed(self, entries: list[str], page: int, *, first: bool = False) -> discord.Embed:
316-
raise NotImplementedError
305+
return None # type: ignore
317306

318307
def get_content(self, entry: str, page: int, *, first: bool = False) -> str:
319308
if self.maximum_pages > 1:

0 commit comments

Comments
 (0)