aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorGravatar jesopo2018-09-26 15:58:16 +0100
committerGravatar jesopo2018-09-26 15:58:16 +0100
commitebc77fa5016a7f204779b0291ec2b6f1cc5596d4 (patch)
tree0654655784c00bd5e7198f15d0cadff5d83f015e /modules
parentUpdate where README.md says bot.db is (diff)
signature
Support using docstrings as command help
Diffstat (limited to 'modules')
-rw-r--r--modules/commands.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/commands.py b/modules/commands.py
index 02787791..74f70e1d 100644
--- a/modules/commands.py
+++ b/modules/commands.py
@@ -179,8 +179,12 @@ class Module(object):
if command in self.events.on("received").on(
"command").get_children():
hooks = self.events.on("received.command").on(command).get_hooks()
- if hooks and "help" in hooks[0].kwargs:
- event["stdout"].write("%s: %s" % (command, hooks[0].kwargs["help"]))
+ kwargs = hooks[0].kwargs
+ help = hooks[0].kwargs.get("help", None
+ ) or hooks[0].function.__doc__
+
+ if help:
+ event["stdout"].write("%s: %s" % (command, help.strip()))
else:
event["stderr"].write("No help available for %s" % command)
else: