""" Sopel plugin: help system for alfred !help - list topics !help - list commands for a topic !help - description and usage for a command Topics: srv, bot, files, irc, coffee """ from sopel import plugin import os as _os, sys as _sys _alfred_dir = _os.path.dirname(_os.path.abspath(__file__)) if _alfred_dir not in _sys.path: _sys.path.insert(0, _alfred_dir) import helpstrings as h def _is_owner(bot, trigger): return trigger.nick == bot.settings.core.owner @plugin.command("help") def cmd_help(bot, trigger): if not _is_owner(bot, trigger): return 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)