From 85c13cbbd7c3f2df51159e1197ba0f1b00763625 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sat, 25 Jan 2020 11:33:38 +0000 Subject: update echo.py to use command spec language --- modules/echo.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'modules') diff --git a/modules/echo.py b/modules/echo.py index 1cbf7532..d1d9d2cb 100644 --- a/modules/echo.py +++ b/modules/echo.py @@ -4,25 +4,23 @@ from src import ModuleManager, utils class Module(ModuleManager.BaseModule): @utils.hook("received.command.echo") - @utils.kwarg("min_args", 1) @utils.kwarg("remove_empty", False) @utils.kwarg("help", "Echo a string back") + @utils.kwarg("spec", "!...") def echo(self, event): - event["stdout"].write(event["args"]) + event["stdout"].write(event["spec"][0]) @utils.hook("received.command.action") - @utils.kwarg("min_args", 1) - @utils.kwarg("expect_output", False) @utils.kwarg("remove_empty", False) @utils.kwarg("help", "Make the bot send a /me") + @utils.kwarg("spec", "!...") def action(self, event): - event["target"].send_message("\x01ACTION %s\x01" % event["args"]) + event["target"].send_message("\x01ACTION %s\x01" % event["spec"][0]) @utils.hook("received.command.msg") - @utils.kwarg("min_args", 2) @utils.kwarg("permission", "say") @utils.kwarg("remove_empty", False) @utils.kwarg("help", "Send a message to a target") + @utils.kwarg("spec", "!word !...") def msg(self, event): - event["server"].send_message(event["args_split"][0], - " ".join(event["args_split"][1:])) + event["server"].send_message(event["spec"][0], event["spec"][1]) -- cgit v1.3.1-10-gc9f91