aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar kwzrd <[email protected]>2020-01-26 22:30:12 +0100
committerGravatar kwzrd <[email protected]>2020-01-26 22:30:12 +0100
commit4199b12da2dedd8720cf521a75a821811af59cfd (patch)
tree294f8b88e63ba2c279c6d362d2d8c412b3395514
parentAdd unit test case for role mentions antispam rule (diff)
Fix incorrect config key in attachments antispam rule
The rule was incorrectly printing out the maximum amount of allowed attachments instead of the configured interval. This commit also adjusts the rule's unit test case.
-rw-r--r--bot/rules/attachments.py2
-rw-r--r--tests/bot/rules/test_attachments.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/bot/rules/attachments.py b/bot/rules/attachments.py
index 00bb2a949..8903c385c 100644
--- a/bot/rules/attachments.py
+++ b/bot/rules/attachments.py
@@ -19,7 +19,7 @@ async def apply(
if total_recent_attachments > config['max']:
return (
- f"sent {total_recent_attachments} attachments in {config['max']}s",
+ f"sent {total_recent_attachments} attachments in {config['interval']}s",
(last_message.author,),
relevant_messages
)
diff --git a/tests/bot/rules/test_attachments.py b/tests/bot/rules/test_attachments.py
index d7187f315..0af5ff0dc 100644
--- a/tests/bot/rules/test_attachments.py
+++ b/tests/bot/rules/test_attachments.py
@@ -20,7 +20,7 @@ class AttachmentRuleTests(unittest.TestCase):
"""Tests applying the `attachments` antispam rule."""
def setUp(self):
- self.config = {"max": 5}
+ self.config = {"max": 5, "interval": 10}
@async_test
async def test_allows_messages_without_too_many_attachments(self):
@@ -88,7 +88,7 @@ class AttachmentRuleTests(unittest.TestCase):
config=self.config
):
desired_output = (
- f"sent {total_attachments} attachments in {self.config['max']}s",
+ f"sent {total_attachments} attachments in {self.config['interval']}s",
culprit,
relevant_messages
)