From e76ea39c712b0fafbe524af5d04a26b822b1dc60 Mon Sep 17 00:00:00 2001 From: jesopo Date: Fri, 21 Jun 2019 10:35:05 +0100 Subject: [PATCH] Don't listen to raw.send.privmsg in linehandler, emulate recv in fake_echo.py --- modules/fake_echo.py | 13 +++++++++++++ modules/line_handler/__init__.py | 2 -- 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 modules/fake_echo.py diff --git a/modules/fake_echo.py b/modules/fake_echo.py new file mode 100644 index 00000000..8177fde5 --- /dev/null +++ b/modules/fake_echo.py @@ -0,0 +1,13 @@ +from src import EventManager, IRCLine, ModuleManager, utils + +class Module(ModuleManager.BaseModule): + @utils.hook("raw.send.privmsg", priority=EventManager.PRIORITY_MONITOR) + @utils.hook("raw.send.notice", priority=EventManager.PRIORITY_MONITOR) + def send_message(self, event): + our_hostmask = utils.irc.seperate_hostmask(event["server"].hostmask()) + + echo = IRCLine.ParsedLine(event["command"], event["args"], + source=our_hostmask, tags=event["tags"]) + echo.id = event["line"].id + + self.events.on("raw.received").call(line=echo, server=event["server"]) diff --git a/modules/line_handler/__init__.py b/modules/line_handler/__init__.py index 37648a58..55455c46 100644 --- a/modules/line_handler/__init__.py +++ b/modules/line_handler/__init__.py @@ -161,9 +161,7 @@ class Module(ModuleManager.BaseModule): # we've received/sent a PRIVMSG, NOTICE or TAGMSG @utils.hook("raw.received.privmsg") - @utils.hook("raw.send.privmsg") @utils.hook("raw.received.notice") - @utils.hook("raw.send.notice") @utils.hook("raw.received.tagmsg") def message(self, event): message.message(self.events, event)