Skip to content
Snippets Groups Projects
Commit 6ab5d0be authored by dnns01's avatar dnns01
Browse files

Hopefully now fixed that f*cking regex

parent 0cd9f910
Branches
No related tags found
No related merge requests found
......@@ -35,12 +35,13 @@ class LinkProtection:
return False
async def event_message(self, message):
if message.author.is_mod:
return
# if message.author.is_mod:
# return
# Mods are always allowed to post links. So if we reach this point, the author of the message is not a mod,
# and we can start checking, whether the message contains a link or not
if links := re.findall(r"(?:https?:\/\/)?([a-zA-Z0-9_-]+\.[a-z]{2,}[a-zA-Z0-9?&=_\/-]*)", message.content):
if links := re.findall(r"(?:https?:\/\/)?((?:[a-zA-Z0-9_-]+\.)+[a-z]{2,}[a-zA-Z0-9?&=_\/-]*)", message.content):
print(links)
for link in links:
if self.lookup_blacklist(link):
await message.channel.timeout(message.author.name, 1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment