From ff2911dbd37a6ceebfc5e351ab9c8995598e2b69 Mon Sep 17 00:00:00 2001 From: nemunaire Date: Tue, 6 Oct 2015 18:36:32 +0200 Subject: [PATCH] Add a subtreat method in modulecontext This feature allows module to call the message treatment process on a crafted message --- nemubot/modulecontext.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nemubot/modulecontext.py b/nemubot/modulecontext.py index ba3a5a1..479b11c 100644 --- a/nemubot/modulecontext.py +++ b/nemubot/modulecontext.py @@ -76,6 +76,8 @@ class ModuleContext: yield i else: yield res + def subtreat(msg): + yield from context.treater.treat_msg(msg) def add_event(evt, eid=None): return context.add_event(evt, eid, module_src=module) def del_event(evt): @@ -104,6 +106,8 @@ class ModuleContext: def call_hook(store, msg): # TODO: what can we do here? return None + def subtreat(msg): + return None def add_event(evt, eid=None): return context.add_event(evt, eid, module_src=module) def del_event(evt): @@ -122,6 +126,7 @@ class ModuleContext: self.save = save self.send_response = send_response self.call_hook = call_hook + self.subtreat = subtreat def unload(self):