aboutsummaryrefslogtreecommitdiff
path: root/modules/echo.py
blob: ee27cc2bc79526c921895e5081e556e915d3e4a1 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#--depends-on commands

from src import ModuleManager, utils

class Module(ModuleManager.BaseModule):
    @utils.hook("received.command.echo")
    @utils.kwarg("min_args", 1)
    def echo(self, event):
        event["stdout"].write(event["args"])

    @utils.hook("received.command.action")
    @utils.kwarg("min_args", 1)
    @utils.kwarg("expect_output", False)
    def action(self, event):
        event["target"].send_message("\x01ACTION %s\x01" % event["args"])

    @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")
    def msg(self, event):
        event["server"].send_message(event["args_split"][0],
            " ".join(event["args_split"][1:]))