Display full help text on bare "!fwarn" and "!fwarn help"

It was listing the warnings on a bare "!fwarn" because re.split()
returned an array containing one element, the empty string. And it's not
really helpful to show just the syntax for the help subcommand in
"!fwarn help", because it already does that in the normal help message,
and also shows the available subcommands.
This commit is contained in:
nyuszika7h 2016-11-19 17:10:50 +01:00
parent 5b0dae3cb3
commit 313d33f1a2

View File

@ -480,7 +480,7 @@ def fwarn(cli, nick, chan, rest):
# If specified, must be prefixed with |. This means | is not a valid character for use # If specified, must be prefixed with |. This means | is not a valid character for use
# in reasons (no escaping is performed). # in reasons (no escaping is performed).
params = re.split(" +", rest) params = rest.split()
target = None target = None
points = None points = None
expires = None expires = None
@ -520,7 +520,7 @@ def fwarn(cli, nick, chan, rest):
try: try:
subcommand = params.pop(0) subcommand = params.pop(0)
except IndexError: except IndexError:
reply(cli, nick, chan, messages["fwarn_help_syntax"]) reply(cli, nick, chan, messages["fwarn_usage"])
return return
if subcommand not in ("list", "view", "add", "del", "set", "help"): if subcommand not in ("list", "view", "add", "del", "set", "help"):
reply(cli, nick, chan, messages["fwarn_usage"]) reply(cli, nick, chan, messages["fwarn_usage"])