Skip to content

Commit

Permalink
Prioritize longer filters
Browse files Browse the repository at this point in the history
  • Loading branch information
s0me-1 committed Apr 16, 2023
1 parent 74bb946 commit a3fbe51
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cogs/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1426,7 +1426,8 @@ def _apply_urlfilters(self, guild, url_filters, em_url):

# Send everything but adapt channel accordingly
elif len(url_filters) > 0:
for channel_id, thread_id, filters in url_filters:
sorted_url_filters = sorted(url_filters, key=lambda f: len(f[2]), reverse=True)
for channel_id, thread_id, filters in sorted_url_filters:
filters_list = filters.split(',')
filters_list_sanitized = [f for f in filters_list if f]
if channel_id and any(f.strip() in em_url for f in filters_list_sanitized):
Expand Down

0 comments on commit a3fbe51

Please sign in to comment.