diff options
author | 2021-03-12 04:48:20 +0100 | |
---|---|---|
committer | 2021-03-12 04:48:20 +0100 | |
commit | 8d93afa4047d3e87fdd1bff6f003e1cfb44bd01c (patch) | |
tree | 24a62b3de457d39acb2414589fdcfeb8dabd23bf | |
parent | Use a clearer approach with less duplicate code (diff) |
Correct length limits to embed limits
Previously the code used limits that apply to raw messages, not embeds.
Both the description and footer limits are separate, while their
individual limits are 2048 chars instead of 2000.
The footer overhead was removed from the max description length
and the footer is now truncated to 200 chars which is roughly 2 lines
-rw-r--r-- | bot/exts/info/doc/_cog.py | 2 | ||||
-rw-r--r-- | bot/exts/info/doc/_parsing.py | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/bot/exts/info/doc/_cog.py b/bot/exts/info/doc/_cog.py index 9e41c6f1e..bf49e0aee 100644 --- a/bot/exts/info/doc/_cog.py +++ b/bot/exts/info/doc/_cog.py @@ -284,7 +284,7 @@ class DocCog(commands.Cog): # with a max of 100 chars. if symbol_name in self.renamed_symbols: renamed_symbols = ', '.join(self.renamed_symbols[symbol_name]) - footer_text = textwrap.shorten("Moved: " + renamed_symbols, 100, placeholder=' ...') + footer_text = textwrap.shorten("Moved: " + renamed_symbols, 200, placeholder=' ...') else: footer_text = "" diff --git a/bot/exts/info/doc/_parsing.py b/bot/exts/info/doc/_parsing.py index 57c991ae0..b06aebd45 100644 --- a/bot/exts/info/doc/_parsing.py +++ b/bot/exts/info/doc/_parsing.py @@ -33,8 +33,8 @@ _NO_SIGNATURE_GROUPS = { _EMBED_CODE_BLOCK_LINE_LENGTH = 61 # _MAX_SIGNATURE_AMOUNT code block wrapped lines with py syntax highlight _MAX_SIGNATURES_LENGTH = (_EMBED_CODE_BLOCK_LINE_LENGTH + 8) * MAX_SIGNATURE_AMOUNT -# Maximum discord message length - signatures on top - space for footer -_MAX_DESCRIPTION_LENGTH = 1900 - _MAX_SIGNATURES_LENGTH +# Maximum embed description length - signatures on top +_MAX_DESCRIPTION_LENGTH = 2048 - _MAX_SIGNATURES_LENGTH _TRUNCATE_STRIP_CHARACTERS = "!?:;." + string.whitespace BracketPair = namedtuple("BracketPair", ["opening_bracket", "closing_bracket"]) |