aboutsummaryrefslogtreecommitdiff
path: root/modules/channel_op.py
diff options
context:
space:
mode:
authorGravatar jesopo2018-08-06 14:27:49 +0100
committerGravatar jesopo2018-08-06 14:27:49 +0100
commitbb53f6f565bc4aecf75ae52ad4a7c83f2f88d1b2 (patch)
tree12863de6b4c13bddd795ea344aa975936977668f /modules/channel_op.py
parentFix 2 typos from the database restructure (diff)
signature
get highlight-spam-protection setting before highlight-spam-threshold
Diffstat (limited to 'modules/channel_op.py')
-rw-r--r--modules/channel_op.py28
1 files changed, 16 insertions, 12 deletions
diff --git a/modules/channel_op.py b/modules/channel_op.py
index b2013627..43251609 100644
--- a/modules/channel_op.py
+++ b/modules/channel_op.py
@@ -113,15 +113,19 @@ class Module(object):
event["target"].send_mode("-v", target)
def highlight_spam(self, event):
- nicknames = list(map(lambda user: user.nickname, event["channel"].users)
- ) + [event["server"].nickname]
- if len(set(nicknames) & set(event["message_split"])) >= event["channel"].get_setting(
- "highlight-spam-threshold", 10):
- protection_enabled = event["channel"].get_setting("highlight-spam-protection", False)
- has_mode = event["channel"].mode_or_above(event["user"], "v")
- should_ban = event["channel"].get_setting("highlight-spam-ban", False)
- if protection_enabled and not has_mode:
- if should_ban:
- event["channel"].send_ban("*!%s@%s" % (event["user"].username,
- event["user"].hostname))
- event["channel"].send_kick(event["user"].nickname, "highlight spam detected")
+ if event["channel"].get_setting("highlight-spam-protection", False):
+ nicknames = list(map(lambda user: user.nickname,
+ event["channel"].users)) + [event["server"].nickname]
+
+ if len(set(nicknames) & set(event["message_split"])
+ ) >= event["channel"].get_setting(
+ "highlight-spam-threshold", 10):
+ has_mode = event["channel"].mode_or_above(event["user"], "v")
+ should_ban = event["channel"].get_setting("highlight-spam-ban",
+ False)
+ if not has_mode:
+ if should_ban:
+ event["channel"].send_ban("*!%s@%s" % (
+ event["user"].username, event["user"].hostname))
+ event["channel"].send_kick(event["user"].nickname,
+ "highlight spam detected")