Help command: skip discovery of command without name

This commit is contained in:
nemunaire 2015-10-07 07:50:19 +02:00
parent ff2911dbd3
commit 684806baaf

View File

@ -100,9 +100,9 @@ class Bot(threading.Thread):
elif msg.args[0][0] == "!":
for module in self.modules:
for (s, h) in self.modules[module].__nemubot_context__.hooks:
if s == "in_Command" and h.is_matching(msg.args[0][1:]):
if s == "in_Command" and (h.name is not None or h.regexp is not None) and h.is_matching(msg.args[0][1:]):
if h.help_usage:
return res.append_message(["\x03\x02%s%s\x03\x02: %s" % (msg.args[0], " " + k if k is not None else "", h.help_usage[k]) for k in h.help_usage], title="Usage for command %s from module %s" % (msg.args[0], module))
return res.append_message(["\x03\x02%s%s\x03\x02: %s" % (msg.args[0], " " + (k if k is not None else ""), h.help_usage[k]) for k in h.help_usage], title="Usage for command %s from module %s" % (msg.args[0], module))
elif h.help:
return res.append_message("Command %s from module %s: %s" % (msg.args[0], module, h.help))
else: