diff options
author | 2021-05-16 22:09:19 +0530 | |
---|---|---|
committer | 2021-05-16 22:09:19 +0530 | |
commit | ab3cf464883d30c5191e3b40328ead90dc518d12 (patch) | |
tree | f46d89e35f8fa651a98ea4427f20962145fe91ed /bot/utils/helpers.py | |
parent | add check for statistics (diff) | |
parent | Spring cleanup (#718) (diff) |
Merge branch 'main' into feature/stackoverflow
Diffstat (limited to 'bot/utils/helpers.py')
-rw-r--r-- | bot/utils/helpers.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/bot/utils/helpers.py b/bot/utils/helpers.py new file mode 100644 index 00000000..74c2ccd0 --- /dev/null +++ b/bot/utils/helpers.py @@ -0,0 +1,8 @@ +import re + + +def suppress_links(message: str) -> str: + """Accepts a message that may contain links, suppresses them, and returns them.""" + for link in set(re.findall(r"https?://[^\s]+", message, re.IGNORECASE)): + message = message.replace(link, f"<{link}>") + return message |