Add subparse method in context, that use server parser
This commit is contained in:
parent
d705d351c0
commit
277d55d521
@ -99,6 +99,10 @@ class ModuleContext:
|
||||
def save():
|
||||
context.datastore.save(module_name, self.data)
|
||||
|
||||
def subparse(orig, cnt):
|
||||
if orig.server in context.servers:
|
||||
return context.servers[orig.server].subparse(orig, cnt)
|
||||
|
||||
self.load_data = load_data
|
||||
self.add_hook = add_hook
|
||||
self.del_hook = del_hook
|
||||
@ -107,6 +111,7 @@ class ModuleContext:
|
||||
self.save = save
|
||||
self.send_response = send_response
|
||||
self.subtreat = subtreat
|
||||
self.subparse = subparse
|
||||
|
||||
|
||||
@property
|
||||
|
@ -268,3 +268,8 @@ class IRC(SocketServer):
|
||||
mes = msg.to_bot_message(self)
|
||||
if mes is not None:
|
||||
yield mes
|
||||
|
||||
|
||||
def subparse(self, orig, cnt):
|
||||
msg = IRCMessage(("@time=%s :%s!user@host.com PRIVMSG %s :%s" % (orig.date.strftime("%Y-%m-%dT%H:%M:%S.%fZ"), orig.frm, ",".join(orig.to), cnt)).encode(self.encoding), self.encoding)
|
||||
return msg.to_bot_message(self)
|
||||
|
Loading…
Reference in New Issue
Block a user