Add quote() function to chat formatting utilities (#4425)

* add quote to chat_formatting

* ...

* jack's request
This commit is contained in:
zephyrkul 2020-09-19 18:12:11 -06:00 committed by GitHub
parent 980b5fa1c2
commit 8a75d75d83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,6 @@
import datetime
import itertools
import textwrap
from io import BytesIO
from typing import Iterator, List, Optional, Sequence, SupportsInt, Union
@ -326,6 +327,23 @@ def underline(text: str, escape_formatting: bool = True) -> str:
return "__{}__".format(text)
def quote(text: str) -> str:
"""Quotes the given text.
Parameters
----------
text : str
The text to be marked up.
Returns
-------
str
The marked up text.
"""
return textwrap.indent(text, "> ", lambda l: True)
def escape(text: str, *, mass_mentions: bool = False, formatting: bool = False) -> str:
"""Get text with all mass mentions or markdown escaped.