diff options
Diffstat (limited to 'jeeves/help.py')
| -rw-r--r-- | jeeves/help.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/jeeves/help.py b/jeeves/help.py new file mode 100644 index 0000000..ac953ff --- /dev/null +++ b/jeeves/help.py @@ -0,0 +1,32 @@ +""" +Sopel plugin: jeeves help + +Three-level help system: + !help - topics overview + !help <topic> - commands in that topic + !help <cmd> - command description + !help <topic> <cmd> - same as above +""" + +import os as _os, sys as _sys +_d = _os.path.dirname(_os.path.abspath(__file__)) +if _d not in _sys.path: + _sys.path.insert(0, _d) +import jv_core as jv +import helpstrings as h + +from sopel import plugin + + +def setup(bot): + jv.ensure_setup(bot) + + +@plugin.command("help") +def cmd_help(bot, trigger): + args = (trigger.group(2) or "").split() + result = h.lookup(args) + if result: + bot.notice(result, trigger.nick) + else: + bot.notice(f"no help for '{' '.join(args)}'. {h.TOPICS}", trigger.nick) |
