| 1 |
from __future__ import absolute_import |
| 2 |
|
| 3 |
from errbot import BotPlugin, botcmd, botmatch, re_botcmd |
| 4 |
|
| 5 |
|
| 6 |
class DummyTest(BotPlugin): |
| 7 |
"""Just a test plugin to see if it is picked up.""" |
| 8 |
|
| 9 |
@botcmd |
| 10 |
def foo(self, msg, args): |
| 11 |
"""This runs foo.""" |
| 12 |
return "bar" |
| 13 |
|
| 14 |
@re_botcmd(pattern=r"plz dont match this") |
| 15 |
def re_foo(self, msg, match): |
| 16 |
"""This runs re_foo.""" |
| 17 |
return "bar" |
| 18 |
|
| 19 |
@botmatch(r"match this") |
| 20 |
def re_bar(self, msg, match): |
| 21 |
"""This runs re_foo.""" |
| 22 |
return "bar" |
| 23 |
|
| 24 |
@botcmd |
| 25 |
def run_subcommands(self, msg, args): |
| 26 |
"""Tests a simple subcommand""" |
| 27 |
return args |
| 28 |
|
| 29 |
@botcmd |
| 30 |
def run_lots_of_subcommands(self, msg, args): |
| 31 |
"""Tests multiple subcommands""" |
| 32 |
return args |
| 33 |
|
| 34 |
def helper_method(self, arg): |
| 35 |
return arg |
| 36 |
|
| 37 |
@botcmd |
| 38 |
def baz(self, msg, args): |
| 39 |
"""Tests mock injection method""" |
| 40 |
return self.helper_method("baz") |
| 41 |
|
| 42 |
@botcmd |
| 43 |
def bar(self, msg, args): |
| 44 |
"""This runs bar.""" |
| 45 |
return msg |