aboutsummaryrefslogtreecommitdiffstats
path: root/bot/utils
diff options
context:
space:
mode:
authorGravatar rohan <[email protected]>2021-05-10 01:58:31 +0530
committerGravatar rohan <[email protected]>2021-05-10 01:58:31 +0530
commit2eda11d5110103d65ee684f4626d7c1ae59b32c9 (patch)
treefbbbcf61ef0797722a1ea8136aaa412cd6283365 /bot/utils
parentFix Bug:Paginated embed image gets carried to next page (diff)
parentMerge pull request #724 from ToxicKidz/fix/mosaic-command (diff)
Pull upstream and resolve conflicts.
Diffstat (limited to 'bot/utils')
-rw-r--r--bot/utils/exceptions.py2
-rw-r--r--bot/utils/helpers.py8
2 files changed, 9 insertions, 1 deletions
diff --git a/bot/utils/exceptions.py b/bot/utils/exceptions.py
index 2b1c1b31..9e080759 100644
--- a/bot/utils/exceptions.py
+++ b/bot/utils/exceptions.py
@@ -1,4 +1,4 @@
class UserNotPlayingError(Exception):
- """Will raised when user try to use game commands when not playing."""
+ """Raised when users try to use game commands when they are not playing."""
pass
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