diff --git a/modules/strip_color.py b/modules/strip_color.py index a1bfa752..37ce9900 100644 --- a/modules/strip_color.py +++ b/modules/strip_color.py @@ -4,7 +4,9 @@ from src import ModuleManager, utils "help": "Set whether I strip colors from my messages on this server", "validate": utils.bool_or_none}) class Module(ModuleManager.BaseModule): - @utils.hook("preprocess.send") + @utils.hook("preprocess.send.privmsg") + @utils.hook("preprocess.send.notice") def preprocess(self, event): if event["server"].get_setting("strip-color", False): - return utils.irc.strip_font(event["line"]) + line = event["line"] + line.args[-1] = utils.irc.strip_font(line.args[-1]) diff --git a/src/IRCServer.py b/src/IRCServer.py index 663f4703..8f2b051b 100644 --- a/src/IRCServer.py +++ b/src/IRCServer.py @@ -238,13 +238,10 @@ class Server(IRCObject.Object): return lines def send(self, line_parsed: IRCLine.ParsedLine): - line = line_parsed.format() - results = self.events.on("preprocess.send").call_unsafe( - server=self, line=line) - results = list(filter(None, results)) - if results: - line = results[0] + self.events.on("preprocess.send").on(line_parsed.command + ).call_unsafe(server=self, line=line_parsed) + line = line_parsed.format() line_stripped = line.split("\n", 1)[0].strip("\r") line_obj = IRCLine.Line(datetime.datetime.utcnow(), self.hostmask(), line_parsed)