From 6230b7836593e125577261d90ec8e8910fa0f739 Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 16 May 2021 15:54:13 +0100 Subject: Bump d.py to 1.7.2 d.py 1.5.1 depending on multidict, which needs gcc installed. Bumping d.py to 1.7.2 removes the need fo rbuild tools in the image. d.py 1.7 introduced the line sep are on the paginator, so this needs to be added to our linepaginator subclass. --- bot/utils/pagination.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'bot/utils/pagination.py') diff --git a/bot/utils/pagination.py b/bot/utils/pagination.py index 742281d7..a0a362cb 100644 --- a/bot/utils/pagination.py +++ b/bot/utils/pagination.py @@ -27,7 +27,14 @@ class EmptyPaginatorEmbed(Exception): class LinePaginator(Paginator): """A class that aids in paginating code blocks for Discord messages.""" - def __init__(self, prefix: str = "```", suffix: str = "```", max_size: int = 2000, max_lines: int = None): + def __init__( + self, + prefix: str = '```', + suffix: str = '```', + max_size: int = 2000, + max_lines: int = None, + linesep: str = "\n" + ): """ Overrides the Paginator.__init__ from inside discord.ext.commands. @@ -36,9 +43,13 @@ class LinePaginator(Paginator): `max_size` and `max_lines` denote the maximum amount of codepoints and lines allowed per page. """ - self.prefix = prefix - self.suffix = suffix - self.max_size = max_size - len(suffix) + super().__init__( + prefix, + suffix, + max_size - len(suffix), + linesep + ) + self.max_lines = max_lines self._current_page = [prefix] self._linecount = 0 -- cgit v1.2.3