aboutsummaryrefslogtreecommitdiff
path: root/modules/echo.py
blob: 8276bd02cbc11a521e9db3d2075d57ad0316cdf0 (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
25
26
#--depends-on commands

from src import ModuleManager, utils

class Module(ModuleManager.BaseModule):
    @utils.hook("received.command.echo")
    @utils.kwarg("remove_empty", False)
    @utils.kwarg("help", "Echo a string back")
    @utils.spec("!...")
    def echo(self, event):
        event["stdout"].write(event["spec"][0])

    @utils.hook("received.command.action")
    @utils.kwarg("remove_empty", False)
    @utils.kwarg("help", "Make the bot send a /me")
    @utils.spec("!...")
    def action(self, event):
        event["target"].send_message("\x01ACTION %s\x01" % event["spec"][0])

    @utils.hook("received.command.msg")
    @utils.kwarg("permission", "say")
    @utils.kwarg("remove_empty", False)
    @utils.kwarg("help", "Send a message to a target")
    @utils.spec("!word !...")
    def msg(self, event):
        event["server"].send_message(event["spec"][0], event["spec"][1])