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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
from __future__ import absolute_import
from errbot import BotPlugin, botcmd, botmatch, re_botcmd
class DummyTest(BotPlugin):
"""Just a test plugin to see if it is picked up."""
@botcmd
def foo(self, msg, args):
"""This runs foo."""
return "bar"
@re_botcmd(pattern=r"plz dont match this")
def re_foo(self, msg, match):
"""This runs re_foo."""
return "bar"
@botmatch(r"match this")
def re_bar(self, msg, match):
"""This runs re_foo."""
return "bar"
@botcmd
def run_subcommands(self, msg, args):
"""Tests a simple subcommand"""
return args
@botcmd
def run_lots_of_subcommands(self, msg, args):
"""Tests multiple subcommands"""
return args
def helper_method(self, arg):
return arg
@botcmd
def baz(self, msg, args):
"""Tests mock injection method"""
return self.helper_method("baz")
@botcmd
def bar(self, msg, args):
"""This runs bar."""
return msg
|