diff options
| author | 2022-10-06 20:26:10 +0300 | |
|---|---|---|
| committer | 2022-10-06 20:26:10 +0300 | |
| commit | 6db78fa911bd529badd67db5a8356c06bc648140 (patch) | |
| tree | a0a0c93ffe0fdff3feee8bbff632b0eeeb55e7e4 | |
| parent | Add filter content processing before posting/patching (diff) | |
Fix bug with setting domain to notify
Unfortunately the filter doesn't know its full effect, only its overrides, so it might not know whether it's going to delete the message or not. This commit prevents errors, but might lead to unwanted behavior if there are two domains in a message, one that causes deletion and one that doesn't, and the second one gets evaluated last. This is basically a 'I hope no one notices' fix until I can think of something better. In practice this shouldn't be an issue.
| -rw-r--r-- | bot/exts/filtering/_filters/domain.py | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/bot/exts/filtering/_filters/domain.py b/bot/exts/filtering/_filters/domain.py index 2a0cd3c31..00a9a886f 100644 --- a/bot/exts/filtering/_filters/domain.py +++ b/bot/exts/filtering/_filters/domain.py @@ -39,11 +39,7 @@ class DomainFilter(Filter): for found_url in ctx.content: if self.content in found_url and tldextract.extract(found_url).registered_domain == domain: ctx.matches.append(self.content) - if ( - ("delete_messages" in self.actions and self.actions.get("delete_messages").delete_messages) - or not ctx.notification_domain - ): # Override this field only if this filter causes deletion. - ctx.notification_domain = self.content + ctx.notification_domain = self.content return not self.extra_fields.exact or self.content == found_url return False |