aboutsummaryrefslogtreecommitdiff
path: root/modules/channel_op.py
diff options
context:
space:
mode:
authorGravatar jesopo2018-09-02 19:54:45 +0100
committerGravatar jesopo2018-09-02 19:54:45 +0100
commit8c6ab17e579cf8f4e510ec324fc98b010ff01cb0 (patch)
treec0437f76bbe9dea31f5f4599450ed5b492eedcd6 /modules/channel_op.py
parentIRCLogging -> Logging (diff)
signature
give an Exports object (actually, ExportsContex object) to each module, to
facilitate things like !set and !channelset without using the events system
Diffstat (limited to 'modules/channel_op.py')
-rw-r--r--modules/channel_op.py29
1 files changed, 13 insertions, 16 deletions
diff --git a/modules/channel_op.py b/modules/channel_op.py
index 9e20d693..7f80d5b3 100644
--- a/modules/channel_op.py
+++ b/modules/channel_op.py
@@ -2,7 +2,7 @@ import Utils
class Module(object):
_name = "Channel Op"
- def __init__(self, bot, events):
+ def __init__(self, bot, events, exports):
self.bot = bot
events.on("received").on("command").on("kick", "k"
).hook(self.kick, channel_only=True, require_mode="o",
@@ -40,21 +40,18 @@ class Module(object):
events.on("received").on("message").on("channel").hook(
self.highlight_spam)
- events.on("postboot").on("configure").on(
- "channelset").assure_call(setting="highlight-spam-threshold",
- help="Set the number of nicknames in a message that "
- "qualifies as spam", validate=Utils.int_or_none)
- events.on("postboot").on("configure").on(
- "channelset").assure_call(setting="highlight-spam-protection",
- help="Enable/Disable highlight spam protection",
- validate=Utils.bool_or_none)
- events.on("postboot").on("configure").on(
- "channelset").assure_call(setting="highlight-spam-ban",
- help="Enable/Disable banning highlight spammers "
- "instead of just kicking", validate=Utils.bool_or_none)
- events.on("postboot").on("configure").on(
- "channelset").assure_call(setting="ban-format",
- help="Set ban format ($n = nick, $u = username, $h = hostname)")
+ exports.add("channelset", {"setting": "highlight-spam-threshold",
+ "help": "Set the number of nicknames in a message that "
+ "qualifies as spam", "validate": Utils.int_or_none})
+ exports.add("channelset", {"setting": "highlight-spam-protection",
+ "help": "Enable/Disable highlight spam protection",
+ "validate": Utils.bool_or_none})
+ exports.add("channelset", {"setting": "highlight-spam-ban",
+ "help": "Enable/Disable banning highlight spammers "
+ "instead of just kicking", "validate": Utils.bool_or_none})
+ exports.add("channelset", {"setting": "ban-format",
+ "help": "Set ban format ($n = nick, $u = username, "
+ "$h = hostname)"})
def kick(self, event):
target = event["args_split"][0]