diff options
author | 2021-05-20 18:30:07 +0530 | |
---|---|---|
committer | 2021-05-20 18:30:07 +0530 | |
commit | d032dd1a0e0fb0f866b1b492f917990d66dae55a (patch) | |
tree | 0adfc37d1350c7eb0b33ea44d4170a44a017e119 /bot/utils/helpers.py | |
parent | Merge remote-tracking branch 'origin/feature/command-suggestions' into featur... (diff) | |
parent | Merge pull request #733 from Icebluewolf/http_status_command_randomness (diff) |
Merge branch 'main' into feature/command-suggestions
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 |