diff --git a/core/utils/chat_formatting.py b/core/utils/chat_formatting.py index fd4cdc0ac..964a5ec37 100644 --- a/core/utils/chat_formatting.py +++ b/core/utils/chat_formatting.py @@ -31,11 +31,11 @@ def italics(text): return "*{}*".format(text) -def pagify(text, delims=["\n"], *, escape=True, shorten_by=8, +def pagify(text, delims=["\n"], *, escape_mass_mentions=True, shorten_by=8, page_length=2000): """DOES NOT RESPECT MARKDOWN BOXES OR INLINE CODE""" in_text = text - if escape: + if escape_mass_mentions: num_mentions = text.count("@here") + text.count("@everyone") shorten_by += num_mentions page_length -= shorten_by @@ -43,14 +43,14 @@ def pagify(text, delims=["\n"], *, escape=True, shorten_by=8, closest_delim = max([in_text.rfind(d, 0, page_length) for d in delims]) closest_delim = closest_delim if closest_delim != -1 else page_length - if escape: + if escape_mass_mentions: to_send = escape(in_text[:closest_delim], mass_mentions=True) else: to_send = in_text[:closest_delim] yield to_send in_text = in_text[closest_delim:] - if escape: + if escape_mass_mentions: yield escape(in_text, mass_mentions=True) else: yield in_text