diff options
| author | 2018-09-02 19:54:45 +0100 | |
|---|---|---|
| committer | 2018-09-02 19:54:45 +0100 | |
| commit | 8c6ab17e579cf8f4e510ec324fc98b010ff01cb0 (patch) | |
| tree | c0437f76bbe9dea31f5f4599450ed5b492eedcd6 /modules/sed.py | |
| parent | IRCLogging -> 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/sed.py')
| -rw-r--r-- | modules/sed.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/modules/sed.py b/modules/sed.py index c276d4d1..74441c4d 100644 --- a/modules/sed.py +++ b/modules/sed.py @@ -5,20 +5,18 @@ REGEX_SPLIT = re.compile("(?<!\\\\)/") REGEX_SED = re.compile("^s/") class Module(object): - def __init__(self, bot, events): + def __init__(self, bot, events, exports): self.bot = bot self.events = events events.on("received").on("message").on("channel").hook( self.channel_message) - events.on("postboot").on("configure").on( - "channelset").assure_call(setting="sed", - help="Disable/Enable sed in a channel", - validate=Utils.bool_or_none) - events.on("postboot").on("configure").on( - "channelset").assure_call(setting="sed-sender-only", - help="Disable/Enable sed only looking at the messages " - "sent by the user", validate=Utils.bool_or_none) + exports.add("channelset", {"setting": "sed", + "help": "Disable/Enable sed in a channel", + "validate": Utils.bool_or_none}) + exports.add("channelset", {"setting": "sed-sender-only", + "help": "Disable/Enable sed only looking at the messages " + "sent by the user", "validate": Utils.bool_or_none}) def channel_message(self, event): sed_split = re.split(REGEX_SPLIT, event["message"], 3) |
