diff --git a/redbot/core/utils/chat_formatting.py b/redbot/core/utils/chat_formatting.py index bd3be79cb..195ab8cd0 100644 --- a/redbot/core/utils/chat_formatting.py +++ b/redbot/core/utils/chat_formatting.py @@ -145,6 +145,28 @@ def italics(text: str, escape_formatting: bool = True) -> str: return "*{}*".format(text) +def spoiler(text: str, escape_formatting: bool = True) -> str: + """Get the given text as a spoiler. + + Note: By default, this function will escape ``text`` prior to making the text a spoiler. + + Parameters + ---------- + text : str + The text to be marked up. + escape_formatting : `bool`, optional + Set to :code:`False` to not escape markdown formatting in the text. + + Returns + ------- + str + The marked up text. + + """ + text = escape(text, formatting=escape_formatting) + return "||{}||".format(text) + + def bordered(*columns: Sequence[str], ascii_border: bool = False) -> str: """Get two blocks of text inside borders.