diff options
author | 2021-06-02 16:21:04 +0530 | |
---|---|---|
committer | 2021-06-02 16:21:04 +0530 | |
commit | bd978b11521d7fd2957d3f8541820029acd26cb5 (patch) | |
tree | b3832bedbd2430789a5f1e4c64b64efb8806dc0d /bot/utils/pagination.py | |
parent | Update branch (diff) | |
parent | Added "centisecond" in trivia_quiz.json (#751) (diff) |
Merge branch 'main' of https://github.com/python-discord/sir-lancebot into feature/stackoverflow
Diffstat (limited to 'bot/utils/pagination.py')
-rw-r--r-- | bot/utils/pagination.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/bot/utils/pagination.py b/bot/utils/pagination.py index 742281d7..d9c0862a 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: Optional[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 |