add more.py
This commit is contained in:
parent
c3ce47b19d
commit
63d9ab19d5
1 changed files with 23 additions and 0 deletions
23
modules/more.py
Normal file
23
modules/more.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
from src import EventManager, ModuleManager, utils
|
||||
|
||||
class Module(ModuleManager.BaseModule):
|
||||
@utils.hook("new.user")
|
||||
@utils.hook("new.channel")
|
||||
def new(self, event):
|
||||
obj = event.get("user", event.get("channel", None))
|
||||
obj._last_stdout = None
|
||||
obj._last_stderr = None
|
||||
|
||||
@utils.hook("postprocess.command")
|
||||
@utils.kwarg("priority", EventManager.PRIORITY_MONITOR)
|
||||
def postprocess(self, event):
|
||||
if event["stdout"].has_text():
|
||||
event["target"]._last_stdout = event["stdout"]
|
||||
if event["stderr"].has_text():
|
||||
event["target"]._last_stderr = event["stderr"]
|
||||
|
||||
@utils.hook("received.command.more")
|
||||
def more(self, event):
|
||||
last_stdout = event["target"]._last_stdout
|
||||
if last_stdout and last_stdout.has_text():
|
||||
event["stdout"].write_lines(last_stdout.get_all())
|
Loading…
Reference in a new issue