aboutsummaryrefslogtreecommitdiffstats
path: root/bot/utils/pagination.py
diff options
context:
space:
mode:
authorGravatar Chris <[email protected]>2021-05-16 15:54:13 +0100
committerGravatar Chris <[email protected]>2021-05-16 15:54:13 +0100
commit6230b7836593e125577261d90ec8e8910fa0f739 (patch)
tree7ab30034988d91d4634e71480b3c64ccf4574b8d /bot/utils/pagination.py
parentRevert bump to d.py (diff)
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.
Diffstat (limited to 'bot/utils/pagination.py')
-rw-r--r--bot/utils/pagination.py19
1 files changed, 15 insertions, 4 deletions
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