aboutsummaryrefslogtreecommitdiff
path: root/modules/sed.py
diff options
context:
space:
mode:
authorGravatar jesopo2018-09-27 12:08:07 +0100
committerGravatar jesopo2018-09-27 12:08:07 +0100
commit6eb8b1ba6d9aaaf7df42f3d705149f02b6a1b871 (patch)
treeece91b1c4d871d5d2b9a3f6319598e33aa13f93f /modules/sed.py
parentUse ModuleManager.BaseModule in more modules (diff)
signature
Move all exports to @Utils.export calls
Diffstat (limited to 'modules/sed.py')
-rw-r--r--modules/sed.py20
1 files changed, 8 insertions, 12 deletions
diff --git a/modules/sed.py b/modules/sed.py
index bae45656..f377daf1 100644
--- a/modules/sed.py
+++ b/modules/sed.py
@@ -1,20 +1,16 @@
import re, traceback
-from src import Utils
+from src import ModuleManager, Utils
REGEX_SPLIT = re.compile("(?<!\\\\)/")
REGEX_SED = re.compile("^s/")
-class Module(object):
- def __init__(self, bot, events, exports):
- self.events = events
-
- 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})
-
+@Utils.export("channelset", {"setting": "sed",
+ "help": "Disable/Enable sed in a channel",
+ "validate": Utils.bool_or_none})
+@Utils.export("channelset", {"setting": "sed-sender-only",
+ "help": "Disable/Enable sed only looking at the messages sent by the user",
+ "validate": Utils.bool_or_none})
+class Module(ModuleManager.BaseModule):
@Utils.hook("received.message.channel")
def channel_message(self, event):
sed_split = re.split(REGEX_SPLIT, event["message"], 3)