bitbot-3.11-fork/modules/echo.py

32 lines
1.1 KiB
Python
Raw Normal View History

#--depends-on commands
2019-04-28 12:36:25 +00:00
from src import ModuleManager, utils
class Module(ModuleManager.BaseModule):
@utils.hook("received.command.echo")
2019-09-26 10:56:37 +00:00
@utils.kwarg("min_args", 1)
@utils.kwarg("argparse", "shlex")
@utils.kwarg("remove_empty", False)
@utils.kwarg("help", "Echo a string back")
2019-04-28 12:36:25 +00:00
def echo(self, event):
event["stdout"].write(event["args"])
2019-09-26 11:27:20 +00:00
@utils.hook("received.command.action")
@utils.kwarg("min_args", 1)
@utils.kwarg("expect_output", False)
@utils.kwarg("remove_empty", False)
@utils.kwarg("argparse", "shlex")
@utils.kwarg("help", "Make the bot send a /me")
2019-09-26 11:27:20 +00:00
def action(self, event):
event["target"].send_message("\x01ACTION %s\x01" % event["args"])
2019-09-27 15:18:49 +00:00
@utils.hook("received.command.msg")
@utils.kwarg("min_args", 2)
@utils.kwarg("permission", "say")
@utils.kwarg("remove_empty", False)
@utils.kwarg("argparse", "shlex")
2019-09-27 15:18:49 +00:00
@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:]))