Don't listen to raw.send.privmsg in linehandler, emulate recv in fake_echo.py

This commit is contained in:
jesopo 2019-06-21 10:35:05 +01:00
parent e7b17f2ccd
commit e76ea39c71
2 changed files with 13 additions and 2 deletions

13
modules/fake_echo.py Normal file
View file

@ -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"])

View file

@ -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)