Skip to content

Commit

Permalink
Small UrlCleaner fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jackra1n committed Aug 22, 2024
1 parent 55bf950 commit c0dfe91
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions extensions/url_cleaner.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def create_rules(self, rules: list[str]):
if len(split_rule) == 1:
self.universal_rules.add(param_rule)
else:
host_pattern = split_rule[1].replace("*.", "(?:.*\.)?")
host_rule = re.compile(f"^(www\.)?{host_pattern}$")
host_pattern = split_rule[1].replace("*.", r"(?:.*\.)?")
host_rule = re.compile(rf"^(www\.)?{host_pattern}$")
host_rule_str = host_rule.pattern

if host_rule_str not in self.host_rules:
Expand Down Expand Up @@ -132,7 +132,7 @@ async def on_message(self, message: discord.Message):

embed = discord.Embed(title="Please avoid sending links containing tracking parameters.")
tracker_list = ", ".join([f"`{tracker}`" for tracker in removed_trackers])
response = f"{tracker_list} {"are" if len(removed_trackers) > 1 else "is"} used for tracking."
response = f"{tracker_list} {'are' if len(removed_trackers) > 1 else 'is'} used for tracking."
response += f"\n Here's the link without trackers:\n{'\n'.join(cleaned_urls)}"
embed.description = response
await message.reply(embed=embed)
Expand Down

0 comments on commit c0dfe91

Please sign in to comment.