Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@botcmd
def hello(self, msg, args):
""" this command says hello """
return 'Hello World !'
@botcmd
def return_args_as_str(self, mess, args):
return "".join(args)
@botcmd
def remove_saw(self, msg, args):
self.destroy_dynamic_plugin('saw')
return 'removed'
@botcmd(template='args_as_md')
def yield_args_as_md(self, mess, args):
for arg in args:
yield {'args': [arg]}
from errbot import BotPlugin
class Double(BotPlugin):
pass
@arg_botcmd('--last-name', dest='last_name', unpack_args=False)
def returns_first_name_last_name_without_unpacking(self, mess, args):
return "%s %s" % (args.first_name, args.last_name)
@arg_botcmd('value', type=str)
@arg_botcmd('--count', dest='count', type=int)
def returns_value_repeated_count_times(self, mess, value=None, count=None):
# str * int gives a repeated string
return value * count
@arg_botcmd('--first-name', dest='first_name')
@arg_botcmd('--last-name', dest='last_name')
def returns_first_name_last_name(self, mess, first_name=None, last_name=None):
return "%s %s" % (first_name, last_name)
@re_botcmd(pattern=r"plz dont match this")
def re_foo(self, msg, match):
"""This runs re_foo."""
return 'bar'
@re_botcmd(pattern=r'^regex command with prefix$', prefixed=True)
def regex_command_with_prefix(self, mess, match):
return "Regex command"