mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
[Utils] Spoiler Function for Chat Formatting (#4754)
* [Utils] Additional chat formatting functions * [Utils] Updated docstrings to unify with other docstrings * [Utils] Spoiler feature for chat_formatting * Fixes for black style Co-authored-by: kreusada <67752638+kreus7@users.noreply.github.com>
This commit is contained in:
parent
1920212eda
commit
82595df730
@ -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.
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user