Skip to content

Commit

Permalink
Merge branch 'main' into add-metricity-to-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
Xithrius committed Sep 17, 2021
2 parents d4c4cce + e6ea46a commit ba761d6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
12 changes: 4 additions & 8 deletions bot/exts/filters/filtering.py
Expand Up @@ -478,16 +478,12 @@ async def _has_urls(self, text: str) -> Tuple[bool, Optional[str]]:
Second return value is a reason of URL blacklisting (can be None).
"""
text = self.clean_input(text)
if not URL_RE.search(text):
return False, None

text = text.lower()
domain_blacklist = self._get_filterlist_items("domain_name", allowed=False)

for url in domain_blacklist:
if url.lower() in text:
return True, self._get_filterlist_value("domain_name", url, allowed=False)["comment"]

for match in URL_RE.finditer(text):
for url in domain_blacklist:
if url.lower() in match.group(1).lower():
return True, self._get_filterlist_value("domain_name", url, allowed=False)["comment"]
return False, None

@staticmethod
Expand Down
8 changes: 5 additions & 3 deletions config-default.yml
Expand Up @@ -157,9 +157,10 @@ guild:
reddit: &REDDIT_CHANNEL 458224812528238616

# Development
dev_contrib: &DEV_CONTRIB 635950537262759947
dev_core: &DEV_CORE 411200599653351425
dev_log: &DEV_LOG 622895325144940554
dev_contrib: &DEV_CONTRIB 635950537262759947
dev_core: &DEV_CORE 411200599653351425
dev_voting: &DEV_CORE_VOTING 839162966519447552
dev_log: &DEV_LOG 622895325144940554

# Discussion
meta: 429409067623251969
Expand Down Expand Up @@ -251,6 +252,7 @@ guild:
- *MESSAGE_LOG
- *MOD_LOG
- *STAFF_VOICE
- *DEV_CORE_VOTING

reminder_whitelist:
- *BOT_CMD
Expand Down

0 comments on commit ba761d6

Please sign in to comment.