aboutsummaryrefslogtreecommitdiffstats
path: root/bot/utils/helpers.py
diff options
context:
space:
mode:
authorGravatar Kieran Siek <[email protected]>2021-06-03 15:58:05 +0800
committerGravatar GitHub <[email protected]>2021-06-03 15:58:05 +0800
commitb60fd23bae52fb59eed0bf29aef2516234d1c858 (patch)
tree0ed0f44d590e8e4891b2f1ab142b10b48fae2763 /bot/utils/helpers.py
parentMake `setup` docstring same as other cogs (diff)
parentAdded "centisecond" in trivia_quiz.json (#751) (diff)
Merge branch 'main' into feature/pride-leaders
Diffstat (limited to 'bot/utils/helpers.py')
-rw-r--r--bot/utils/helpers.py8
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