diff options
-rw-r--r-- | bot/cogs/help.py | 2 | ||||
-rw-r--r-- | bot/pagination.py | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/bot/cogs/help.py b/bot/cogs/help.py index 542f19139..f59d30c9a 100644 --- a/bot/cogs/help.py +++ b/bot/cogs/help.py @@ -299,7 +299,7 @@ class CustomHelpCommand(HelpCommand): embed, prefix=description, max_lines=COMMANDS_PER_PAGE, - max_size=2040, + max_size=2000, ) async def send_bot_help(self, mapping: dict) -> None: diff --git a/bot/pagination.py b/bot/pagination.py index 34ce7317b..97ef08ad6 100644 --- a/bot/pagination.py +++ b/bot/pagination.py @@ -58,10 +58,20 @@ class LinePaginator(Paginator): """ self.prefix = prefix self.suffix = suffix + + # Embeds that exceed 2048 characters will result in an HTTPException + # (Discord API limit), so we've set a limit of 2000 + if max_size > 2000: + raise ValueError(f"max_size must be <= 2,000 characters. ({max_size} > 2000)") + self.max_size = max_size - len(suffix) + if scale_to_size < max_size: raise ValueError(f"scale_to_size must be >= max_size. ({scale_to_size} < {max_size})") + if scale_to_size > 2000: + raise ValueError(f"max_size must be <= 2,000 characters. ({scale_to_size} > 2000)") + self.scale_to_size = scale_to_size - len(suffix) self.max_lines = max_lines self._current_page = [prefix] |