diff options
| author | 2019-11-26 14:18:12 +0000 | |
|---|---|---|
| committer | 2019-11-26 14:18:12 +0000 | |
| commit | 63d9ab19d5e07ac78f0bc85c6f85e507906e0cdc (patch) | |
| tree | cbccc3442645d76995a1f3b8bbe5dba51f33a52b /modules | |
| parent | update wikipedia.py to use Response.json() (diff) | |
| signature | ||
add more.py
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/more.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/modules/more.py b/modules/more.py new file mode 100644 index 00000000..52849938 --- /dev/null +++ b/modules/more.py @@ -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()) |
