Skip to content

Commit

Permalink
Merge branch 'master' of github.com:errbotio/errbot
Browse files Browse the repository at this point in the history
  • Loading branch information
gbin committed Aug 12, 2017
2 parents 4c3bc06 + c263987 commit 75638b3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 7 additions & 3 deletions errbot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ def _tag_botcmd(func,
matchall=False, # re_cmd_only
prefixed=True, # re_cmd_only
_arg=False,
command_parser=None): # arg_cmd only
command_parser=None, # arg_cmd only
re_cmd_name_help=None): # re_cmd_only
"""
Mark a method as a bot command.
"""
Expand All @@ -90,6 +91,7 @@ def _tag_botcmd(func,
func._err_command_matchall = matchall
func._err_command_prefix_required = prefixed
func._err_command_syntax = pattern
func._err_command_re_name_help = re_cmd_name_help

# arg_cmd
func._err_arg_command = _arg
Expand Down Expand Up @@ -161,7 +163,8 @@ def re_botcmd(*args,
flags: int=0,
matchall: bool=False,
prefixed: bool=True,
flow_only: bool=False) -> Callable[[BotPlugin, Message, Any], Any]:
flow_only: bool=False,
re_cmd_name_help: str=None) -> Callable[[BotPlugin, Message, Any], Any]:
"""
Decorator for regex-based bot command functions
Expand Down Expand Up @@ -210,7 +213,8 @@ def decorator(func):
flags=flags,
matchall=matchall,
prefixed=prefixed,
flow_only=flow_only)
flow_only=flow_only,
re_cmd_name_help=re_cmd_name_help)
return decorator(args[0]) if args else decorator


Expand Down
3 changes: 2 additions & 1 deletion errbot/core_plugins/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ def _cmd_help_line(self, name, command, show_doc=False):
patt = getattr(command, '_err_command_re_pattern', None)

if patt:
name = patt.pattern
re_help_name = getattr(command, '_err_command_re_name_help', None)
name = re_help_name if re_help_name else patt.pattern

if not show_doc:
cmd_doc = cmd_doc.split('\n')[0]
Expand Down

0 comments on commit 75638b3

Please sign in to comment.