diff options
| author | Ahmed <git@gumx.cc> | 2026-06-14 01:46:29 +0300 |
|---|---|---|
| committer | Ahmed <git@gumx.cc> | 2026-06-14 01:46:29 +0300 |
| commit | 5a8d568931d9b23ce0df1265d05259a7012081c9 (patch) | |
| tree | 4ea19b8bb1763a38246f342f172c285f6579e09b /osterman/help.py | |
init: mostly vibed
Diffstat (limited to 'osterman/help.py')
| -rw-r--r-- | osterman/help.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/osterman/help.py b/osterman/help.py new file mode 100644 index 0000000..fdc94c0 --- /dev/null +++ b/osterman/help.py @@ -0,0 +1,30 @@ +""" +Sopel plugin: osterman help system + + !help list topics + !help <topic> list commands for a topic + !help <topic> <cmd> description and usage for a command + !help <cmd> description and usage (topic not required) +""" + +import os as _os, sys as _sys +_osterman_dir = _os.path.dirname(_os.path.abspath(__file__)) +if _osterman_dir not in _sys.path: + _sys.path.insert(0, _osterman_dir) +import helpstrings as h + +from sopel import plugin + + +def _notice(bot, nick, text): + bot.notice(text, nick) + + +@plugin.command("help", "h") +def cmd_help(bot, trigger): + args = (trigger.group(2) or "").split() + result = h.lookup(args) + if result: + _notice(bot, trigger.nick, result) + else: + _notice(bot, trigger.nick, f"no help for '{' '.join(args)}'. {h.TOPICS}") |
