diff options
author | 2021-08-30 22:09:44 -0400 | |
---|---|---|
committer | 2021-08-30 22:09:44 -0400 | |
commit | 8bc54b2e2aeaeef30efd9f7f684cce48b7b64daf (patch) | |
tree | 91e844d1431a127815d33406139e5798341b533a /bot/utils/helpers.py | |
parent | Numerous syntax and bug fixes (diff) | |
parent | Merge pull request #831 from brad90four/patch-1 (diff) |
Update branch with main
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 |