aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorGravatar jesopo2019-06-21 10:35:05 +0100
committerGravatar jesopo2019-06-21 10:35:05 +0100
commite76ea39c712b0fafbe524af5d04a26b822b1dc60 (patch)
tree229b56d60a42684201eb8a8d28b557372539ad56 /modules
parentgive every ParsedLine a uuid4 .id for tracking purposes (diff)
signature
Don't listen to raw.send.privmsg in linehandler, emulate recv in fake_echo.py
Diffstat (limited to 'modules')
-rw-r--r--modules/fake_echo.py13
-rw-r--r--modules/line_handler/__init__.py2
2 files changed, 13 insertions, 2 deletions
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)