From 8eaa3218404aae02cb69a63d59f9b7b7699ef5f9 Mon Sep 17 00:00:00 2001 From: Zodiac Date: Wed, 12 Feb 2025 23:15:50 -0800 Subject: [PATCH] fix --- plugins/services/anti_spam.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/services/anti_spam.py b/plugins/services/anti_spam.py index 2a38467..4650bd4 100644 --- a/plugins/services/anti_spam.py +++ b/plugins/services/anti_spam.py @@ -89,7 +89,15 @@ class AntiSpam: Returns: bool: True if the message is considered spam, False otherwise. """ - user = self.user_data[nick.lower()] + nick = nick.lower() + if nick not in self.user_data: + self.user_data[nick] = { + 'messages': deque(maxlen=int(self.config.get('repeat_limit', 3))), + 'timestamps': deque(maxlen=int(self.config.get('spam_limit', 5))), + 'mentions': deque(maxlen=int(self.config.get('mention_limit', 2))) + } + user = self.user_data[nick] + now = time.time() # Check message length