aboutsummaryrefslogtreecommitdiffstats
path: root/jeeves/help.py
blob: ac953ffcb177bd096d7933fb3455ce92179f32ba (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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)